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.
Moduleyesod-core-1.6.26.0Haskell2010
Yesod.Core.Dispatch
- 4 types
- 2 classes
- 28 values
- Packageyesod-core-1.6.26.0
- Exports34
- LanguageHaskell2010
- LicenceMIT
- SourceParse.hs
Quasi-quoted routing
7 declarationsSame as parseRoutes, but performs no overlap checking.
Same as parseRoutes, but uses an external file instead of quasiquotation.
The recommended file extension is .yesodroutes.
Same as parseRoutesNoCheck, but uses an external file instead of quasiquotation.
The recommended file extension is .yesodroutes.
Generates URL datatype and site function for the given Resources. This is used for creating sites, not subsites. See mkYesodSubData and mkYesodSubDispatch for the latter. Use parseRoutes to create the Resources.
Contexts and type variables in the name of the datatype are parsed.
For example, a datatype App a with typeclass constraint MyClass a can be written as "(MyClass a) => App a".
mkYesod but with custom options.
mkYesodWith Deprecated. Contexts and type variables are now parsed from the name in mkYesod. https://github.com/yesodweb/yesod/pull/1366
Similar to mkYesod, except contexts and type variables are not parsed.
Instead, they are explicitly provided.
You can write (MyClass a) => App a with mkYesodWith [["MyClass","a"]] "App" ["a"] ....
More fine-grained
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.
mkYesodData but with custom options.
See mkYesodData.
See mkYesodDataOpts
Route generation options
General opts data type for generating yesod.
Contains options for what instances are derived for the route. Use the setting functions on defaultOpts to set specific fields.
Default options for generating routes.
Defaults to all instances derived.
Helpers
Default constructor for yreGetMaxExpires field. Low level function for simple manual construction of YesodRunnerEnv.
Path pieces
Methods
fromPathPiece :: Text -> Maybe stoPathPiece :: s -> Text
Instances18PathPiece, …
PathPiece IntegerDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece StringDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Int16Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Int32Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Int64Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Int8Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Word16Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Word32Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Word64Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece Word8Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece BoolDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece IntDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece WordDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece TextDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece TextDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece DayDefined in path-pieces-0.2.1 · Web.PathPiecesPathPiece ()Defined in path-pieces-0.2.1 · Web.PathPiecesPathPiece a => PathPiece (Maybe a)Defined in path-pieces-0.2.1 · Web.PathPieces
Methods
fromPathMultiPiece :: [Text] -> Maybe stoPathMultiPiece :: s -> [Text]
Instances1PathMultiPiece
PathPiece a => PathMultiPiece [a]Defined in path-pieces-0.2.1 · Web.PathPieces
Convert to WAI
8 declarationsSame as toWaiAppPlain, but provides a default set of middlewares. This set may change with future releases, but currently covers:
Logging
GZIP compression
Automatic HEAD method handling
Request method override with the _method query string parameter
Accept header override with the _accept query string parameter
Convert the given argument into a WAI application, executable with any WAI handler. This function will provide no middlewares; if you want commonly used middlewares, please use toWaiApp.
Pure low level function to construct WAI application. Usefull when you need not standard way to run your app, or want to embed it inside another app.
A convenience method to run an application using the Warp webserver on the specified port. Automatically calls toWaiApp. Provides a default set of middlewares. This set may change at any point without a breaking version number. Currently, it includes:
Logging
GZIP compression
Automatic HEAD method handling
Request method override with the _method query string parameter
Accept header override with the _accept query string parameter
If you need more fine-grained control of middlewares, please use toWaiApp directly.
Since 1.2.0
Deprecated. Please use warp instead
Deprecated synonym for warp.
Runs your application using default middlewares (i.e., via toWaiApp). It reads port information from the PORT environment variable, as used by tools such as Keter and the FP Complete School of Haskell.
Note that the exact behavior of this function may be modified slightly over time to work correctly with external tools, without a change to the type signature.
A default set of middlewares.
Since 1.2.0
All of the default middlewares, excluding logging.
Since 1.2.12
WAI subsites
2 declarationsWrap up a normal WAI application as a Yesod subsite. Ignore parent site's middleware and isAuthorized.
Constructors
Instances8ParseRoute, RenderRoute, YesodSubDispatch, Eq, Ord, Read, …
ParseRoute WaiSubsiteDefined in yesod-core-1.6.26.0 · Yesod.Core.TypesRenderRoute WaiSubsiteDefined in yesod-core-1.6.26.0 · Yesod.Core.TypesYesodSubDispatch WaiSubsite masterDefined in yesod-core-1.6.26.0 · Yesod.Core.Class.DispatchEq (Route WaiSubsite)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesOrd (Route WaiSubsite)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesRead (Route WaiSubsite)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesShow (Route WaiSubsite)Defined in yesod-core-1.6.26.0 · Yesod.Core.Typesdata Route WaiSubsiteDefined in yesod-core-1.6.26.0 · Yesod.Core.Types
Like WaiSubsite, but applies parent site's middleware and isAuthorized.
Constructors
Instances8ParseRoute, RenderRoute, YesodSubDispatch, Eq, Ord, Read, …
ParseRoute WaiSubsiteWithAuthDefined in yesod-core-1.6.26.0 · Yesod.Core.TypesRenderRoute WaiSubsiteWithAuthDefined in yesod-core-1.6.26.0 · Yesod.Core.TypesYesodSubDispatch WaiSubsiteWithAuth masterDefined in yesod-core-1.6.26.0 · Yesod.Core.Class.DispatchEq (Route WaiSubsiteWithAuth)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesOrd (Route WaiSubsiteWithAuth)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesRead (Route WaiSubsiteWithAuth)Defined in yesod-core-1.6.26.0 · Yesod.Core.TypesShow (Route WaiSubsiteWithAuth)Defined in yesod-core-1.6.26.0 · Yesod.Core.Typesdata Route WaiSubsiteWithAuthDefined in yesod-core-1.6.26.0 · Yesod.Core.Types