Liking cljdoc? Tell your friends :D

reacl-basics.pages.routes


-route-matchesclj

(-route-matches this request)
source

clear-routes!clj/s

(clear-routes!)

Clears the global set of defined-routes.

Clears the global set of [[defined-routes]].
sourceraw docstring

defined-routesclj/s

An atom with a set of all routes created by defroute since the last call to clear-routes!.

An atom with a set of all routes created by [[defroute]] since the last call to [[clear-routes!]].
sourceraw docstring

defrouteclj/smacro

(defroute name pattern)

Defines a var with the given name to be a route according the given pattern, and adds it to the global set of defined-routes.

A pattern can be a fixed path "/path/to/page", or can have one or more path arguments "/article/:id".

For example:

(defroute r0 "/home")

(href r0) => "/home"
(parse r0 "/home") => []
(href r0 {:lang "de"}) => "/home?lang=de"
(parse r0 "/home?lang=de") => [{:lang "de"}]

(defroute r1 "/path/:id")

(href r1 "123") => "/path/123"
(parse r1 "/path/123") => ["123"]
(parse r1 "/other/path") => nil
Defines a var with the given `name` to be a route according the given `pattern`, and adds it to the global set of [[defined-routes]].

A pattern can be a fixed path `"/path/to/page"`, or can have one or more path arguments `"/article/:id"`.

For example:

```clojure
(defroute r0 "/home")

(href r0) => "/home"
(parse r0 "/home") => []
(href r0 {:lang "de"}) => "/home?lang=de"
(parse r0 "/home?lang=de") => [{:lang "de"}]

(defroute r1 "/path/:id")

(href r1 "123") => "/path/123"
(parse r1 "/path/123") => ["123"]
(parse r1 "/other/path") => nil
```
source (clj)source (cljs)raw docstring

hrefcljs

(href route & params)

Returns a relative URI for the given route and concrete values for all parameters. The last parameter may be a map of query params.

Returns a relative URI for the given route and concrete values for all parameters. The last parameter may be a map of query params.
sourceraw docstring

parsecljs

(parse route uri)

If the given URI matches the given route, returns a vector of all path arguments and optionally a map of query params.

If the given URI matches the given route, returns a vector of all path arguments and optionally a map of query params.
sourceraw docstring

routable?clj/s

(routable? v)

If v is a value returned by [[route]] of bound to a name with defroute.

If `v` is a value returned by [[route]] of bound to a name with [[defroute]].
sourceraw docstring

route-matchesclj

(route-matches route request)
source

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

× close