How to stop Jetty Server in CLOJURE?

I use ring and clojure to write a web application. I use jetty adapter for development server and emacs/SLIME IDE. Although wrap-reload helps, run-jetty blocks my slime session, and I want to be able to start/stop it without having to run it in a separate terminal session. Ideally, I want to define a server proxy and functions start-server and stop-server, which will start/stop the server in the proxy. is it possible?
I usually have a line in my ring application that looks like the following:

(defonce server (run-jetty #'my-app {:port 8080 :join? false}))

This prevents the REPL from being locked. It also allows me to recompile this file without worrying about my server being redefined. It also allows you to interact in the REPL like this:

user=> (.stop server)

and

user=> (.start server)

I use ring and clojure to write a web application. I use jetty adapter for development server and emacs/SLIME IDE. Although wrap-reload helps, run-jetty blocks my slime session, and I want to be able to start/stop it without having to run it in a separate terminal session. Ideally, I want to define a server proxy and functions start-server and stop-server, which will start/stop the server in the proxy. is it possible?

I usually have a line in my ring application that looks like the following:

(defonce server (run-jetty #'my-app {:port 8080 :join? false}))

This prevents the REPL from being locked. It also allows me to recompile this file without worrying about my server being redefined. It also allows you to interact in the REPL like this:

user=> (.stop server)

and

user=> (.start server)

Leave a Comment

Your email address will not be published.