Concepts
Last updated
A web application developed for Ring consists of four components: Handler Request Response Middleware Handlers Handlers are functions that define your web application. They take one argument, a map representing ...
Content Types
Last updated
You can use the wrap-content-type middleware to add a Content-Type header based on the file extension in the URI: ( use 'ring.middleware.content-type) ( def app ( wrap-content-type your-handler)) ...
Cookies
Last updated
To add cookie support to your Ring handler, you'll need to wrap it in the wrap-cookies middleware: ( use 'ring.middleware.cookies) ( def app ( wrap-cookies your-handler)) This adds the :cookies ...
Creating responses
Last updated
You can create Ring response maps manually (see Concepts ), but the ring.util.response namespace contains a number of useful function to make this task easier. The response function creates a basic "200 ...
Examples
Last updated
Hello World Hello World with ring.util.response Form parameters Sessions
File Uploads
Last updated
Uploading a file to a website requires multipart form handling, which Ring provides with its wrap-multipart-params middleware. ( use 'ring.middleware.params 'ring.middleware.multipart-params) ...
Getting Started
Last updated
Create a new project with Leiningen . $ lein new hello-world $ cd hello-world Add ring-core and ring-jetty-adapter as a dependencies in project.clj . ( defproject hello-world " 1.0.0-SNAPSHOT " ...
Home
Last updated
Moved to https://github.com/ring-clojure/ring/wiki
Interactive Development
Last updated
When developing with Ring, you may find yourself wanting to reload your source files without restarting your development server. There are three ways of doing this: I. Using Lein-Ring The easiest way is ...
Middleware Patterns
Last updated
Adding keys to the request map Keys can be added to the request map to pass additonal information to the handler and other middleware. Here is an example that adds a :user key to the request, if there ...