我正在尝试在 Ring 之上运行 Aleph 并lein ring server
用于更短的反馈循环。
当我调用lein ring server
一切似乎都很好,但是当我将浏览器指向一个 url 时,我NullPointerException
对下面的堆栈跟踪感到讨厌。
但是,当我跑步时,(al.app/start 3006)
没有NLP
出现。
整个项目在GitHub上可用。
我究竟做错了什么?
core.clj:107 lamina.core/enqueue
app.clj:39 al.app/hello-handler
http.clj:79 aleph.http/wrap-aleph-handler[fn]
response.clj:27 compojure.response/eval1328[fn]
response.clj:10 compojure.response/eval1289[fn]
core.clj:93 compojure.core/make-route[fn]
core.clj:39 compojure.core/if-route[fn]
...
我正在使用 aleph 0.3.2,这是我的代码:
(ns al.app
(:use
aleph.http
lamina.core
compojure.core
ring.middleware.keyword-params)
(:require [compojure.route :as route]))
(defn hello-handler
"Our handler for the /hello path"
[ch request]
(let [params (:route-params request)
name (params :name)]
(enqueue ch
{:status 200
:headers {}
:body (str "Hello " name)})))
(defroutes my-routes
(GET ["/hello/:name", :name #"[a-zA-Z]+"] {} (wrap-aleph-handler hello-handler))
(route/not-found "Page not found"))
(defn start
"Start our server in the specified port"
[port]
(start-http-server (wrap-ring-handler my-routes) {:port port}))