Liking cljdoc? Tell your friends :D

compojure.core

A DSL for building Ring handlers from smaller routes.

Compojure routes are semantically the same as Ring handlers, with the exception that routes may return nil to indicate they do not match.

This namespace provides functions and macros for concisely constructing routes and combining them together to form more complex functions.

A DSL for building Ring handlers from smaller routes.

Compojure routes are semantically the same as Ring handlers, with the
exception that routes may return `nil` to indicate they do not match.

This namespace provides functions and macros for concisely constructing
routes and combining them together to form more complex functions.
raw docstring

ANYcljmacro

(ANY path args & body)

Generate a route that matches any method.

Generate a route that matches any method.
sourceraw docstring

compile-routeclj

(compile-route method path bindings body)

Compile a route in the form (method path bindings & body) into a function. Used to create custom route macros.

Compile a route in the form `(method path bindings & body)` into a function.
Used to create custom route macros.
sourceraw docstring

contextcljmacro

(context path args & routes)

Give all routes in the form a common path prefix and set of bindings.

The following example demonstrates defining two routes with a common path prefix ('/user/:id') and a common binding ('id'):

(context "/user/:id" [id]
  (GET "/profile" [] ...)
  (GET "/settings" [] ...))
Give all routes in the form a common path prefix and set of bindings.

The following example demonstrates defining two routes with a common
path prefix ('/user/:id') and a common binding ('id'):

    (context "/user/:id" [id]
      (GET "/profile" [] ...)
      (GET "/settings" [] ...))
sourceraw docstring

defroutescljmacro

(defroutes name & routes)

Define a Ring handler function from a sequence of routes. The name may optionally be followed by a doc-string and metadata map.

Define a Ring handler function from a sequence of routes. The name may
optionally be followed by a doc-string and metadata map.
sourceraw docstring

DELETEcljmacro

(DELETE path args & body)

Generate a DELETE route.

Generate a `DELETE` route.
sourceraw docstring

GETcljmacro

(GET path args & body)

Generate a GET route.

Generate a `GET` route.
sourceraw docstring

(HEAD path args & body)

Generate a HEAD route.

Generate a `HEAD` route.
sourceraw docstring

let-routescljmacro

(let-routes bindings & body)

Takes a vector of bindings and a body of routes.

Equivalent to:

(let [...] (routes ...))
Takes a vector of bindings and a body of routes.

Equivalent to:

    (let [...] (routes ...))
sourceraw docstring

make-routeclj

(make-route method path handler)

Returns a function that will only call the handler if the method and path match the request.

Returns a function that will only call the handler if the method and path
match the request.
sourceraw docstring

OPTIONScljmacro

(OPTIONS path args & body)

Generate an OPTIONS route.

Generate an `OPTIONS` route.
sourceraw docstring

PATCHcljmacro

(PATCH path args & body)

Generate a PATCH route.

Generate a `PATCH` route.
sourceraw docstring

POSTcljmacro

(POST path args & body)

Generate a POST route.

Generate a `POST` route.
sourceraw docstring

PUTcljmacro

(PUT path args & body)

Generate a PUT route.

Generate a `PUT` route.
sourceraw docstring

rfncljmacro

(rfn args & body)

Generate a route that matches any method and path.

Generate a route that matches any method and path.
sourceraw docstring

routesclj

(routes & handlers)

Create a Ring handler by combining several handlers into one.

Create a Ring handler by combining several handlers into one.
sourceraw docstring

routingclj

(routing request & handlers)

Apply a list of routes to a Ring request map.

Apply a list of routes to a Ring request map.
sourceraw docstring

wrap-routesclj

(wrap-routes handler middleware)
(wrap-routes handler middleware & args)

Apply a middleware function to routes after they have been matched.

Apply a middleware function to routes after they have been matched.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close