cleanup server.cljs a tad
Left some in-editor execution stuff in there
This commit is contained in:
parent
5886d6cf9a
commit
b72952b415
@ -1,6 +1,9 @@
|
|||||||
(ns picture-processor.server)
|
(ns picture-processor.server)
|
||||||
|
|
||||||
|
; js requires
|
||||||
(def express (js/require "express"))
|
(def express (js/require "express"))
|
||||||
|
|
||||||
|
; the currently running server
|
||||||
(def server (atom nil))
|
(def server (atom nil))
|
||||||
|
|
||||||
(defn- root-response
|
(defn- root-response
|
||||||
@ -11,18 +14,16 @@
|
|||||||
"Start the app server"
|
"Start the app server"
|
||||||
[port]
|
[port]
|
||||||
(let [app (express)]
|
(let [app (express)]
|
||||||
|
; build the routing tree
|
||||||
(.get app "/" root-response)
|
(.get app "/" root-response)
|
||||||
(let [-server (.listen app port #(.log js/console (str "Server listening on port " port)))]
|
(let [-server (.listen app
|
||||||
(reset! server -server)
|
port
|
||||||
(.log js/console @server)
|
#(.log js/console (str "Server listening on port "
|
||||||
)))
|
port)))]
|
||||||
|
(reset! server -server))))
|
||||||
|
|
||||||
(defn stop
|
(defn stop
|
||||||
"Stop the app server"
|
"Stop the app server"
|
||||||
[]
|
[]
|
||||||
(.close @server)
|
(.close @server)
|
||||||
(reset! server nil))
|
(reset! server nil))
|
||||||
|
|
||||||
(start 3000)
|
|
||||||
(stop)
|
|
||||||
(.log js/console @server)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user