Yesod.Default.Main

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

Safe Haskell | None
Language | Haskell2010

Yesod.Default.Main

Synopsis

- defaultMain :: IO (AppConfig env extra) -> (AppConfig env extra -> IO Application) -> IO ()
- defaultMainLog :: IO (AppConfig env extra) -> (AppConfig env extra -> IO (Application, LogFunc)) -> IO ()
- defaultRunner :: (Application -> IO ()) -> Application -> IO ()
- defaultDevelApp :: IO (AppConfig env extra) -> (AppConfig env extra -> IO Application) -> IO (Int, Application)
- type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO ()

# Documentation

defaultMain :: IO (AppConfig env extra) -> (AppConfig env extra -> IO Application) -> IO () #

Run your app, taking environment and port settings from the commandline.

``fromArgs`` helps parse a custom configuration

    main :: IO ()
    main = defaultMain (fromArgs parseExtra) makeApplication

defaultMainLog :: IO (AppConfig env extra) -> (AppConfig env extra -> IO (Application, LogFunc)) -> IO () #

Same as `defaultMain`, but gets a logging function back as well as an `Application` to install Warp exception handlers.

Since 1.2.5

defaultRunner :: (Application -> IO ()) -> Application -> IO () #

Run your application continuously, listening for SIGINT and exiting when received

    withYourSite :: AppConfig DefaultEnv -> Logger -> (Application -> IO a) -> IO ()
    withYourSite conf logger f = do
        Settings.withConnectionPool conf $ \p -> do
            runConnectionPool (runMigration yourMigration) p
            defaultRunner f $ YourSite conf logger p

defaultDevelApp #

Arguments

:: IO (AppConfig env extra) | A means to load your development ``AppConfig``
-> (AppConfig env extra -> IO Application) | Get your `Application`
-> IO (Int, Application) |

Run your development app using a custom environment type and loader function

type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO () #