snap-predicates-0.3.0: Declarative routing for Snap.

Safe HaskellNone

Snap.Route

Synopsis

Documentation

data Routes m a Source

The Routes monad is used to add routing declarations via addRoute or one of get, post, etc. Routing declarations can then be turned into the ordinary snap format, i.e. MonadSnap m => [(ByteString, m a)] or into strings.

Instances

showRoutes :: Routes m () -> [String]Source

Turn route definitions into a list of Strings.

expandRoutes :: MonadSnap m => Routes m () -> [(ByteString, m ())]Source

Turn route definitions into "snapable" format, i.e. Routes are grouped per path and selection evaluates routes against the given Snap Request.

addRouteSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> Method 
-> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Add a route for some Method and path (potentially with variable captures), and constrained the some Predicate.

getSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

get_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

headSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

head_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

postSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

post_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

putSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

put_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

deleteSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

delete_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

traceSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

trace_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

optionsSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

options_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.

connectSource

Arguments

:: (MonadSnap m, Show p, Predicate p Request, FVal p ~ Error) 
=> ByteString

path

-> (TVal p -> m ())

handler

-> p

Predicate

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method.

connect_Source

Arguments

:: MonadSnap m 
=> ByteString

path

-> (() -> m ())

handler

-> Routes m () 

Specialisation of addRoute for a specific HTTP Method taking no Predicate into consideration.