Route middleware for wai.
It's Heavy inspired by vhost
middleware from wai-extra
but
gives some sugar to life.
- type Rule = Request -> Bool
- type Route = (Rule, Application)
- dispatch :: [Route] -> Application -> Application
- (&~~) :: Method -> ByteString -> Rule
Documentation
type Route = (Rule, Application)Source
Route for dispatch
:: [Route] | List of routes |
-> Application | Default |
-> Application | Returns founded |
:: Method | HTTP Method |
-> ByteString | Request path pattern. |
-> Rule | Routing rule |
Syntax shugar for most frequently case: HTTP Method and Request path regex pattern.
("GET" &~~ "^/issues", app)