Utilities for client side routing, i.e. multiple pages in a so called single page application.
The basic usage is to define routes and page functions, and the use a router component near the toplevel of your application to show different contents based on the current browser location URL:
(routes/defroutes my-app
  (routes/defroute home "/"))
(html5-history-router {home (constantly "Hello World")})
Utilities for client side routing, i.e. multiple pages in a so called
single page application.
The basic usage is to define routes and page functions, and the use
a router component near the toplevel of your application to show
different contents based on the current browser location URL:
```
(routes/defroutes my-app
  (routes/defroute home "/"))
(html5-history-router {home (constantly "Hello World")})
```
Functions to help serving the client code in a ring server of a so called single page application for all routes handled on the client side.
After defining the routes (in a 'cljc' file):
(routes/defroutes my-app
  (routes/defroute home "/"))
you can create a ring handler that serves the client html with a suitable ring response:
(-> handler
    (wrap-client-routes my-app response))
Functions to help serving the client code in a ring server of a so
called single page application for all routes handled on the client
side.
After defining the routes (in a 'cljc' file):
```
(routes/defroutes my-app
  (routes/defroute home "/"))
```
you can create a ring handler that serves the client html with a
suitable ring response:
```
(-> handler
    (wrap-client-routes my-app response))
```
Functions to define and use the routes in a client side routing application.
A typical usage would be to define the routes of an application in a
shared cljc file, and use them with
a core/html5-history-router in the client, and
with ring/wrap-client-routes on the server side to deliver the
client code for all of these routes.
You can also call routes as a function, passing the defined path and query params, and get a 'href' back that be use in anchor tags to let the user navigate to the pages of the application.
Functions to define and use the routes in a client side routing application. A typical usage would be to define the routes of an application in a shared `cljc` file, and use them with a [[core/html5-history-router]] in the client, and with [[ring/wrap-client-routes]] on the server side to deliver the client code for all of these routes. You can also call routes as a function, passing the defined path and query params, and get a 'href' back that be use in anchor tags to let the user navigate to the pages of the application.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |