Skip to content

Instantly share code, notes, and snippets.

@edoloughlin
Created July 2, 2012 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edoloughlin/3033784 to your computer and use it in GitHub Desktop.
Save edoloughlin/3033784 to your computer and use it in GitHub Desktop.
lein ring server doesn't call
;;
;; My project.clj file:
;;
(defproject my-server/my-server "0.0.1"
:description "My REST API"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/java.jdbc "0.2.1"]
[org.clojure/data.xml "0.0.3"]
[slingshot "0.10.2"]
[ring "1.1.1"]
[ring-json-params "0.1.3"]
[compojure "1.1.0"]
[org.webbitserver/webbit "0.2.0"]
[clj-json "0.5.0"]
[clj-record "1.1.1"]
[clj-time "0.4.3"]
[mmemail "1.0.2"]
;[clojureql "1.0.3"]
[mysql/mysql-connector-java "5.1.20"]
[org.clojure/tools.logging "0.2.3"]
[log4j "1.2.15"
:exclusions [javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]]
:dev-dependencies [[lein-ring "0.5.4"]
[ring-serve "0.1.1"]]
:min-lein-version "2.0.0"
:ring {:handler my.core/boot})
;;
;; my/core.clj file:
;;
; [...]
;; Compojure routes
(defroutes api-routes
; [etc...]
)
(defn api []
(-> api-routes
wrap-params
wrap-error-handling
ring-params/wrap-params))
(defn boot [& boot-args]
(dbg boot-args)
(config/init)
(websocket/init)
(println "http-port: " config/http-port)
; In config.clj, http-port is (def http-port 8080)
(run-jetty api {:port config/http-port}))
;; When I do a 'lein ring server-headless' then core/boot isn't called (there's no output
;; from (dbg boot-args) or the (println)). Jetty starts on port 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment