开发者

Where's run-server gone in compojure?

I used to be able to start a web server in compojure like this:

(run-server {:port 8080} "/*" (servlet my-app))

Does anyone know where this function has gone in the latest compojure? (0.6开发者_高级运维.2)

The docs say I'm supposed to run it from the command line and use some freaky auto-reloading thing, at which point I might as well be using python.


You're looking at some seriously out-dated documentation.

For jetty, use

(use 'ring.adapter.jetty)

(defn start-web []
  (run-jetty (var my-site) {:port 8080 :join? false}))

Where my-site is your top-level handler function.

You can call that function anywhere, including from the REPL in SLIME. Recompiling/redefining my-site will work on a running server, so there's no need for auto-reloading if you're already using an interactive environment.

EDIT: compojure has been split into ring & clout, with compojure itself remaining as a small selection of higher-level abstractions on top. Most of the actual server stuff and design documentation is now in ring. See https://github.com/mmcgrana/ring/wiki

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜