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

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.

mkYesodSource

Arguments

:: String

name of the argument datatype

-> [Resource] 
-> 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 
-> [Resource] 
-> 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 -> [Resource] -> 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.

Path pieces

class MultiPiece s where

Instances

type Strings = [String]

Convert to WAI

toWaiApp :: (Yesod y, YesodSite y) => y -> IO ApplicationSource

Convert the given argument into a WAI application, executable with any WAI handler. You can use basicHandler if you wish.

basicHandlerSource

Arguments

:: (Yesod y, YesodSite y) 
=> Int

port number

-> y 
-> IO () 

Runs an application with CGI if CGI variables are present (namely PATH_INFO); otherwise uses SimpleServer.

basicHandler'Source

Arguments

:: (Yesod y, YesodSite y) 
=> Int

port number

-> Maybe String

host name, Nothing to show nothing

-> y 
-> IO () 

Same as basicHandler, but allows you to specify the hostname to display to the user. If Nothing is provided, then no output is produced.