New Clojure Projectλ︎
Create a new Clojure project using Clojure CLI
Create a new project using the :project/create
alias from Practicalli Clojure CLI Config and the app
template using deps-new
Create a new project using the :project/new
alias from Practicalli Clojure CLI Config and the app template using clj-new
Add web server libraryλ︎
Add either Ring (Jetty) or Httpkit library as a project dependency to run an embedded server that listens to HTTP requests and passes those requests to the Clojure service.
Add a ring library that includes an embedded Jetty server.
The ring/ring
library includes all ring libraries including the embedded Jetty server
Edit the project deps.edn
file and add the ring/ring {:mvn/version "1.9.5"}
dependency to the top-level :deps
key, which defines the libraries used to make the project.
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.3"}
ring/ring {:mvn/version "1.9.6"}}}
Or add the ring/ring-core
and ring/ring-jetty-adapter
libraries, saving a few millisecond when starting the project.
Add the HTTP Kit Server library which includes the client and server namespaces, although only the Server namespace will be used.
Edit the project deps.edn
file and add the http-kit/http-kit {:mvn/version "2.3.0"}
dependency to the top-level :deps
key, which defines the libraries used to make the project.
Ring libraryλ︎
Ring is a Clojure web applications library inspired by Python's WSGI and Ruby's Rack. By abstracting the details of HTTP into a simple, unified API, Ring allows web applications to be constructed of modular components that can be shared among a variety of applications, web servers, and web frameworks.
Ring is composed of several libraries which can be included specifically, rather than requiring all of them with ring/ring
ring/ring-core
- essential functions for handling parameters, cookies and morering/ring-devel
- functions for developing and debugging Ring applicationsring/ring-servlet
- construct Java servlets from Ring handlersring/ring-jetty-adapter
- a Ring adapter that uses the Jetty webserver