snap-web-routes
Version 0.5.1.0 revision 0 uploaded by lukerandall.
Package meta
- Synopsis
- Type safe URLs for Snap
- Description
Type safe URL generation and routing for Snap using web-routes, and builds on work done by Jeremy Shaw.
Get started with the comprehensive tutorial.
Brief overview
It allows you to define a data type that represents the routes in your application:
data AppUrl = Login -- routes to /login | Logout -- routes to /logout | User (Resource UserId) -- provides RESTful routes at /user
Resource is documented in Snap.Snaplet.Router.REST, and makes defining RESTful routes easier. Also provided are functions to use the URL data type in your app:
someHandler :: Handler App App () someHandler :: doSomething >> redirectURL $ User Index
and to generate URLs in views:
linksHandler :: Handler App App () linksHandler = heistLocal (I.bindSplices linksSplices) $ render "links" where linksSplices = do "loginUrl" ## urlSplice Login
- Author
- Luke Randall
- Bug reports
- https://github.com/lukerandall/snap-web-routes/issues
- Category
- Web, Snap
- Copyright
- n/a
- Homepage
- https://github.com/lukerandall/snap-web-routes
- Maintainer
- luke.randall@gmail.com
- Package URL
- n/a
- Stability
- n/a