0

I am not able to get any response from the http-kit server when running using boot. It works with jetty. When I run the boot run the it exits after sometime. So I added (boot (wait)) which doesn't terminate, but the server seems to be not running.

; core.clj
(ns server.core
    (:use [compojure.route :only [files not-found]]
          [compojure.handler :only [site]]
          [compojure.core :only [defroutes GET POST DELETE ANY context]]
          org.httpkit.server))

(defn hello [] 
    "Hello from httpkit")

(defroutes api-routes
    (GET "/" [] (hello)))

(defn -main []
    (run-server api-routes {:port 8080}))

The boot.clj file:

;boot.clj
(set-env!
    :source-paths #{"src"}
    :dependencies '[[org.clojure/clojure "1.8.0"]
                    [ring "1.5.0"]
                    [compojure "1.5.1"]
                    [http-kit "2.2.0"]])

(require '[server.core :as server])

(deftask run []
    (with-pre-wrap fileset (server/-main) fileset)
    (boot (wait)))

1 Answers1

0

You can use boot-http and something like the following:

 (boot (serve :handler 'server/-main :reload true) (wait))
Michael Kohl
  • 66,324
  • 14
  • 138
  • 158
  • I used boot-http and ran it like this: `(boot (serve :handler 'server.core/-main :reload true) (wait)))`. But boot is starting jetty at 3000 and when loading the url I get `Problem accessing /. Reason: Wrong number of args (1) passed to: core/-main`. It's very easy and straight forward to use lein, not sure why boot is making this difficult. –  Oct 17 '16 at 15:37