practicalli / clojure-web-services

Develop production grade server-side web services and APIs using Clojure and REPL driven development
https://practical.li/clojure-web-services
Creative Commons Attribution Share Alike 4.0 International
11 stars 14 forks source link

Repl driven development with ring server #8

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

Update: use Clojure CLI, reitit over Leiningen approach

Instead of lein ring server and having to set up an nrepl connection to the running process (or use wrap-reload), you can start a repl in the project and then start the ring server (jetty, etc) from inside the repl (or evaluating some commented out code in the source file)

Starting the ring server inside the clojure-jack-in repl will block further input at the REPL buffer.

Use the join? option to be able to interact with repl after starting a ring server

Set join? to false to continue using the repl after starting the server and allows request handlers to be changed without restarting the repl or server.

-dev-main function is often created to set different code for development. This is also suggested by lein-ring for including wrap-reload.

-repl-main could be a function that is configured to start the ring server using the join? option

join? option - set to false to prevent the server blocking https://ring-clojure.github.io/ring/ring.adapter.jetty.html