remove public/index.js and make it so express can be stopped/started
This commit is contained in:
parent
46d42cc966
commit
5886d6cf9a
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,5 +12,6 @@ pom.xml.asc
|
|||||||
/.repl-*
|
/.repl-*
|
||||||
/.cljs_node_repl/
|
/.cljs_node_repl/
|
||||||
/public/out
|
/public/out
|
||||||
|
/public/index.js
|
||||||
/images
|
/images
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
[lein-npm "0.6.1"]]
|
[lein-npm "0.6.1"]]
|
||||||
:source-paths ["src/server" "src/client"]
|
:source-paths ["src/server" "src/client"]
|
||||||
:npm { :dependencies [[ws "0.4.30"]
|
:npm { :dependencies [[ws "0.4.30"]
|
||||||
[imagemagick-native "https://github.com/elad/node-imagemagick-native.git"]]}
|
[imagemagick-native "https://github.com/elad/node-imagemagick-native.git"]
|
||||||
|
[express "4.13.3"]]}
|
||||||
:cljsbuild {
|
:cljsbuild {
|
||||||
:builds [{:source-paths ["src/server"]
|
:builds [{:source-paths ["src/server"]
|
||||||
:compiler {
|
:compiler {
|
||||||
@ -45,4 +46,5 @@
|
|||||||
[org.clojure/clojurescript "1.7.170"]
|
[org.clojure/clojurescript "1.7.170"]
|
||||||
[org.omcljs/om "0.9.0"]
|
[org.omcljs/om "0.9.0"]
|
||||||
[sablono "0.3.6"]
|
[sablono "0.3.6"]
|
||||||
|
[cljs-http "0.1.39"]
|
||||||
])
|
])
|
||||||
|
72568
public/index.js
72568
public/index.js
File diff suppressed because it is too large
Load Diff
28
src/server/picture_processor/server.cljs
Normal file
28
src/server/picture_processor/server.cljs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
(ns picture-processor.server)
|
||||||
|
|
||||||
|
(def express (js/require "express"))
|
||||||
|
(def server (atom nil))
|
||||||
|
|
||||||
|
(defn- root-response
|
||||||
|
[req res]
|
||||||
|
(.send res "made it"))
|
||||||
|
|
||||||
|
(defn start
|
||||||
|
"Start the app server"
|
||||||
|
[port]
|
||||||
|
(let [app (express)]
|
||||||
|
(.get app "/" root-response)
|
||||||
|
(let [-server (.listen app port #(.log js/console (str "Server listening on port " port)))]
|
||||||
|
(reset! server -server)
|
||||||
|
(.log js/console @server)
|
||||||
|
)))
|
||||||
|
|
||||||
|
(defn stop
|
||||||
|
"Stop the app server"
|
||||||
|
[]
|
||||||
|
(.close @server)
|
||||||
|
(reset! server nil))
|
||||||
|
|
||||||
|
(start 3000)
|
||||||
|
(stop)
|
||||||
|
(.log js/console @server)
|
Loading…
Reference in New Issue
Block a user