Hi:
(var app) can be simplified to just app.
The detail:
app is a function: accept a request map, return a response map. your
server's logic is in app.
( see ring spec https://github.com/ring-clojure/ring/blob/master/SPEC for
more detail)
(var app) or #'app: get the var (clojure.lang.Var) of the function.
when (#'app request-map) :
will call Var's invoke function:
public Object invoke(Object arg1) {
return fn().invoke(arg1);
}
final public IFn fn(){
return (IFn) deref();
}
after deref(), you just get app.
i found some remarks about being able to change the app without
> having to restart the server but how exactly does this relate ?
Yes. It's possible. The easiest of doing that is by
using https://github.com/weavejester/lein-ring
On Saturday, January 19, 2013 7:54:08 AM UTC+8, faenvie wrote:
>
> dear clojure users,
>
> i have learned that for a ring/compojure-app the embedded jetty
> service can be started like this:
>
> (def app (handler/site routes))
>
> (defn start [port]
> (ring/run-jetty (var app) {:port (or port 8080)
> :join? false}))
>
> can anyone explain, what is the var for ? why '(var app)' or #'app ?
> i found some remarks about being able to change the app without
> having to restart the server but how exactly does this relate ?
>
>
> thanks & have a successful time
>
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en