Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :wrap option for adding middleware #249

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/gorilla_repl/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
(route/resources "/" {:root "gorilla-repl-client"})
(route/files "/project-files" {:root "."}))


(defn run-gorilla-server
[conf]
;; get configuration information from parameters
Expand All @@ -36,6 +35,8 @@
nrepl-requested-port (or (:nrepl-port conf) 0) ;; auto-select port if none requested
nrepl-port-file (io/file (or (:nrepl-port-file conf) ".nrepl-port"))
gorilla-port-file (io/file (or (:gorilla-port-file conf) ".gorilla-port"))
wrap (:wrap conf identity)
app (wrap app-routes)
project (or (:project conf) "no project")
keymap (or (:keymap (:gorilla-options conf)) {})
_ (handle/update-excludes (fn [x] (set/union x (:load-scan-exclude (:gorilla-options conf)))))]
Expand All @@ -49,7 +50,7 @@
;; first startup nREPL
(nrepl/start-and-connect nrepl-requested-port nrepl-port-file)
;; and then the webserver
(let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip :max-body 500000000})
(let [s (server/run-server app {:port webapp-requested-port :join? false :ip ip :max-body 500000000})
webapp-port (:local-port (meta s))]
(spit (doto gorilla-port-file .deleteOnExit) webapp-port)
(println (str "Running at http://" ip ":" webapp-port "/worksheet.html ."))
Expand Down