Liking cljdoc? Tell your friends :D

goophi.routing


->routecljmacro

(->route pattern vars & body)

Returns a function that takes a request map as argument. The function evaluates body and returns the value of the expression if pattern is matching the request path. Parameters are bound to vars.

Example: (->route "/blog/posts/:id" [id] (get-post id))

Use the :as keyword to assign the entire request map to a symbol.

Example: (->route "/blog/:category/search" [category :as req] (search-category category (:query req)))

Returns a function that takes a request map as argument. The function
evaluates body and returns the value of the expression if pattern is
matching the request path. Parameters are bound to vars.

Example:
  (->route
   "/blog/posts/:id"
   [id]
   (get-post id))

Use the :as keyword to assign the entire request map to a symbol.

Example:
  (->route
   "/blog/:category/search"
   [category :as req]
   (search-category category (:query req)))
sourceraw docstring

->routescljmacro

(->routes & routes)

Returns a function that takes a request map as argument. The function evaluates the body of the first route matching the request path and returns the value of the expression. Parameters are bound to vars.

Example: (->routes ("/blog/posts/:id" [id] (get-post id))

("/blog/:category/search" [category :as req] (search-category category (:query req))))

Returns a function that takes a request map as argument. The function
evaluates the body of the first route matching the request path and
returns the value of the expression. Parameters are bound to vars.

Example:
  (->routes
   ("/blog/posts/:id"
    [id]
    (get-post id))

   ("/blog/:category/search"
    [category :as req]
    (search-category category (:query req))))
sourceraw docstring

compile-patternclj

(compile-pattern pattern)

Compiles a pattern. Patterns may consist of literals, escaped characters, wildcards (*) and parameters (:name). The syntax is very similar to to Clout (https://github.com/weavejester/clout). That's no surprise, because the code is similar too :)

Compiles a pattern. Patterns may consist of literals, escaped
characters, wildcards (*) and parameters (:name). The syntax is
very similar to to Clout (https://github.com/weavejester/clout).
That's no surprise, because the code is similar too :)
sourceraw docstring

matchesclj

(matches route request)

Tests if request is matching the pattern associated to route. Returns a map containing path, query and matched parameters on success.

Tests if request is matching the pattern associated to route.
Returns a map containing path, query and matched parameters on
success.
sourceraw docstring

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

× close