yesod-default-0.5.0: Default config and main functions for your yesod application

Yesod.Default.Main

Synopsis

Documentation

defaultMain :: (Show env, Read env) => IO (AppConfig env extra) -> (AppConfig env extra -> Logger -> (Application -> IO ()) -> IO ()) -> IO ()Source

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

Use fromArgs when using the provided DefaultEnv type, or fromArgsWith when using a custom type

 main :: IO ()
 main = defaultMain fromArgs withMySite

or

 main :: IO ()
 main = defaultMain (fromArgsWith customArgConfig) withMySite

defaultRunnerSource

Arguments

:: (YesodDispatch y y, Yesod y) 
=> (Application -> IO a) 
-> y

your foundation type

-> IO () 

Run your application continously, listening for SIGINT and exiting when recieved

 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 :: (AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()) -> ((Int, Application) -> IO ()) -> IO ()Source

Run your development app using the provided DefaultEnv type

 withDevelAppPort :: Dynamic
 withDevelAppPort = toDyn $ defaultDevelApp withMySite

defaultDevelAppWithSource

Arguments

:: (Show env, Read env) 
=> IO (AppConfig env extra)

A means to load your development AppConfig

-> (AppConfig env extra -> Logger -> (Application -> IO ()) -> IO ())

Your withMySite function

-> ((Int, Application) -> IO ()) 
-> IO () 

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

 withDevelAppPort :: Dynamic
 withDevelAppPort = toDyn $ (defaultDevelAppWith customLoadAppConfig) withMySite