Wheb-0.2.0.0: The frictionless WAI Framework

Safe HaskellNone
LanguageHaskell2010

Web.Wheb.InitM

Contents

Synopsis

Routes

Named routes convenience functions

addGET :: Text -> UrlPat -> WhebHandlerT g s m -> InitM g s m () Source

addPOST :: Text -> UrlPat -> WhebHandlerT g s m -> InitM g s m () Source

addPUT :: Text -> UrlPat -> WhebHandlerT g s m -> InitM g s m () Source

addDELETE :: Text -> UrlPat -> WhebHandlerT g s m -> InitM g s m () Source

Sites

addSite :: Text -> Site url (WhebHandlerT g s m) -> InitM g s m () Source

Add raw routes

addRoute :: Route g s m -> InitM g s m () Source

addRoutes :: [Route g s m] -> InitM g s m () Source

catchAll :: WhebHandlerT g s m -> InitM g s m () Source

Catch all requests regardless of method or path

Sockets

addWhebSocket :: UrlPat -> WhebSocket g s m -> InitM g s m () Source

Middlewares

addWAIMiddleware :: Middleware -> InitM g s m () Source

Add generic WAI middleware

addWhebMiddleware :: WhebMiddleware g s m -> InitM g s m () Source

Add Wheb specific middleware

Settings

addSetting :: Text -> Text -> InitM g s m () Source

Wrapped addSetting' to help prevent monomorphism errors for simple settings.

addSetting' :: Typeable a => Text -> a -> InitM g s m () Source

Adds a setting value, replacing it if its key already exists.

readSettingsFile :: FilePath -> InitM g s m () Source

Reads a file line by line and splits keys and values by ":". Uses default Text.Read to try to match Int, Bool or Float and will add specific typed settings for those.

Cleanup

addCleanupHook :: IO () -> InitM g s m () Source

IO Actions to run after server has been stopped.

Running

generateOptions :: MonadIO m => InitM g s m (g, s) -> IO (WhebOptions g s m) Source

Generate WhebOptions from InitM in IO

genMinOpts :: InitM () () IO () -> IO MinOpts Source

Generate options for an application without a context or state