Safe Haskell | Safe-Infered |
---|
This module contains helpers for use Yesod.Routes.Dispatch with Network.Wai.
This Middleware
uses first Piece
in path to route HTTP
method.
Static
means concrete method. Dynamic
means any method.
- dispatch :: Dispatch Application -> Application -> Application
- sGET, sOPTIONS, sCONNECT, sTRACE, sDELETE, sPUT, sHEAD, sPOST :: Text -> Application -> Route Application
- sANY :: Text -> Application -> Route Application
- mGET, mOPTIONS, mCONNECT, mTRACE, mDELETE, mPUT, mHEAD, mPOST :: Text -> Application -> Route Application
- mANY :: Text -> Application -> Route Application
- sGET', sOPTIONS', sCONNECT', sTRACE', sDELETE', sPUT', sHEAD', sPOST' :: [Piece] -> Application -> Route Application
- sANY' :: [Piece] -> Application -> Route Application
- sRoute :: Piece -> [Piece] -> Application -> Route Application
- mGET', mOPTIONS', mCONNECT', mTRACE', mDELETE', mPUT', mHEAD', mPOST' :: [Piece] -> Application -> Route Application
- mANY' :: [Piece] -> Application -> Route Application
- mRoute :: Piece -> [Piece] -> Application -> Route Application
- mkP :: Text -> [Piece]
Middleware
:: Dispatch Application | Dispatch function.
Use |
-> Application | Default ( |
-> Application |
Dispatch function.
rs :: Dispatch Application rs = toDispatch [ -- simple paths sGET "foo" fooGetApp , sPOST "foo" fooPostApp , sGET "foo/" fooGetDynApp -- native paths , sGET' [Static "bar", Dynamic] barGetDynApp -- simple paths, any method , sANY "any" anyMethodApp ] app :: Application app = dispatch rs (error "Not dispatched")
Route helpers
Functions below simplify process of creating Route
s. Each helper
prepends corresponding HTTP
method to path.
Simple paths
All functions below is combinations of native path helpers and mkP
.
Fixed length
sGET,sOPTIONS,sCONNECT,sTRACE,sDELETE,sPUT,sHEAD,sPOSTSource
:: Text | Path |
-> Application | Routable application |
-> Route Application |
Route
helpers for concrete HTTP
methods with fixed-length
simple path.
:: Text | Path |
-> Application | Routable application |
-> Route Application |
Route
helper for any HTTP
method with fixed-length simple path.
Variable length
mGET,mOPTIONS,mCONNECT,mTRACE,mDELETE,mPUT,mHEAD,mPOSTSource
:: Text | Path |
-> Application | Routable application |
-> Route Application |
Route
helpers for concrete HTTP
methods with vary-length
simple path.
:: Text | Path |
-> Application | Routable application |
-> Route Application |
Route
helper for any HTTP
method with vary-length simple path.
Native paths
Fixed length
sGET',sOPTIONS',sCONNECT',sTRACE',sDELETE',sPUT',sHEAD',sPOST'Source
:: [Piece] | Path |
-> Application | Routable application |
-> Route Application |
Route
helpers for concrete HTTP
methods with fixed-length native
yesod-routes
path.
:: [Piece] | Path |
-> Application | Routable application |
-> Route Application |
Route
helper for any HTTP
method with fixed-length native
yesod-routes
path.
:: Piece | Method piece. |
-> [Piece] | Path pieces |
-> Application | Routed application |
-> Route Application |
Generalized Route
helper for fixed-length native
yesod-routes
path.
Variable length
mGET',mOPTIONS',mCONNECT',mTRACE',mDELETE',mPUT',mHEAD',mPOST'Source
:: [Piece] | Path |
-> Application | Routable application |
-> Route Application |
Route
helpers for concrete HTTP
methods with vary-length native
yesod-routes
path.
:: [Piece] | Path |
-> Application | Routable application |
-> Route Application |
Route
helper for any HTTP
method with fixed-length native
yesod-routes
path.
:: Piece | Method piece. |
-> [Piece] | Path pieces |
-> Application | Routed application |
-> Route Application |
Generalized Route
helper for vary-length native
yesod-routes
path.