reitit/doc/frontend/browser.md
2018-08-23 10:41:13 +03:00

27 lines
989 B
Markdown

# Frontend browser integration
**WIP**
Reitit includes two browser history integrations.
Functions follow HTML5 History API: `push-state` to change route, `replace-state`
to change route without leaving previous entry in browser history.
## Fragment router
Fragment is simple integration which stores the current route in URL fragment,
i.e. after `#`. This means the route is never part of the request URI and
server will always know which file to return (`index.html`).
## HTML5 router
HTML5 History API can be used to modify the URL in browser without making
request to the server. This means the URL will look normal, but the downside is
that the server must respond to all routes with correct file (`index.html`).
Check examples for simple Ring handler example.
## Easy
Reitit frontend routers require storing the state somewhere and passing it to
all the calls. Wrapper (`reitit.frontend.easy`) is provided which manages
router instance and passes the instance to all calls.