yesod-core-1.1.8.3: Creation of type-safe, RESTful web applications.

Safe HaskellNone

Yesod.Dispatch

Contents

Synopsis

Quasi-quoted routing

parseRoutes :: QuasiQuoter

A quasi-quoter to parse a string into a list of Resources. Checks for overlapping routes, failing if present; use parseRoutesNoCheck to skip the checking. See documentation site for details on syntax.

parseRoutesNoCheck :: QuasiQuoter

Same as parseRoutes, but performs no overlap checking.

mkYesodSource

Arguments

:: String

name of the argument datatype

-> [ResourceTree String] 
-> Q [Dec] 

Generates URL datatype and site function for the given Resources. This is used for creating sites, not subsites. See mkYesodSub for the latter. Use parseRoutes to create the Resources.

mkYesodSubSource

Arguments

:: String

name of the argument datatype

-> Cxt 
-> [ResourceTree String] 
-> Q [Dec] 

Generates URL datatype and site function for the given Resources. This is used for creating subsites, not sites. See mkYesod for the latter. Use parseRoutes to create the Resources. In general, a subsite is not executable by itself, but instead provides functionality to be embedded in other sites.

More fine-grained

mkYesodData :: String -> [ResourceTree String] -> Q [Dec]Source

Sometimes, you will want to declare your routes in one file and define your handlers elsewhere. For example, this is the only way to break up a monolithic file into smaller parts. Use this function, paired with mkYesodDispatch, to do just that.

mkDispatchInstanceSource

Arguments

:: CxtQ

The context

-> TypeQ

The subsite type

-> TypeQ

The master site type

-> [ResourceTree a]

The resource

-> DecsQ 

If the generation of YesodDispatch instance require finer control of the types, contexts etc. using this combinator. You will hardly need this generality. However, in certain situations, like when writing library/plugin for yesod, this combinator becomes handy.

Path pieces

type Texts = [Text]Source

Convert to WAI

toWaiApp :: (Yesod master, YesodDispatch master master) => master -> IO ApplicationSource

Convert the given argument into a WAI application, executable with any WAI handler. This is the same as toWaiAppPlain, except it includes two middlewares: GZIP compression and autohead. This is the recommended approach for most users.

toWaiAppPlain :: (Yesod master, YesodDispatch master master) => master -> IO ApplicationSource

Convert the given argument into a WAI application, executable with any WAI handler. This differs from toWaiApp in that it uses no middlewares.

WAI subsites

newtype WaiSubsite Source

Wrap up a normal WAI application as a Yesod subsite.

Constructors

WaiSubsite