Use the Ring Library to create a webserverλ︎
The Ring library can start an embedded Java server (eg. Jetty, Tomcat) to listen for requests from a browser. Each browser request received is converted into a request map, a Clojure map with keys and values. This request map is passed to a handler function, which returns a response map.
In the section you will discover how to:
- Add the Ring library as a dependency
- Including Ring in the namespace
- Add a main function to run a Jetty webserver
- Configure the project's main namespace
- Run webserver
We will cover some related theory on Coercing types (also known as casting types) to help us deal with Java interoperability.
We will also cover how to manage the scope of your Clojure code with Namespaces.
Ring is covered in more detail in the next section, once you have your first webserver up and running.