| Safe Haskell | Safe-Infered |
|---|
Network.Wai.Middleware.Route
Contents
Description
Route middleware for wai.
It's Heavy inspired by vhost middleware from wai-extra but
gives some sugar to life.
- dispatch :: [(Request -> Bool, Application)] -> Application -> Application
- onRegex :: Method -> ByteString -> Request -> Bool
- onPrefix :: Method -> ByteString -> Request -> Bool
- onExact :: Method -> ByteString -> Request -> Bool
Dispatching
Arguments
| :: [(Request -> Bool, Application)] | List of routes |
| -> Application | Default |
| -> Application | Returns founded |
Creating rules
Arguments
| :: Method | HTTP Method. Use |
| -> ByteString | Request path pattern. |
| -> Request | Request |
| -> Bool |
Most frequently case: HTTP Method and Request path regex pattern.
("*" `rule` "^/issue/", app)
(methodGet `rule` "^/issues$", anotherApp)
Arguments
| :: Method | HTTP Method. Use |
| -> ByteString | Request path prefix. |
| -> Request | Request |
| -> Bool | Routing rule |
HTTP Method and Request path prefix.
("*" `rule` "^/issue/", app)
(methodGet `rule` "^/issues$", anotherApp)