Yesod.Default.Main
- defaultMain :: (Show e, Read e) => IO (AppConfig e) -> (AppConfig e -> Logger -> (Application -> IO ()) -> IO ()) -> IO ()
- defaultRunner :: (YesodDispatch y y, Yesod y) => (Application -> IO a) -> y -> IO ()
- defaultDevelApp :: (AppConfig DefaultEnv -> Logger -> (Application -> IO ()) -> IO ()) -> ((Int, Application) -> IO ()) -> IO ()
- defaultDevelAppWith :: (Show e, Read e) => IO (AppConfig e) -> (AppConfig e -> Logger -> (Application -> IO ()) -> IO ()) -> ((Int, Application) -> IO ()) -> IO ()
Documentation
defaultMain :: (Show e, Read e) => IO (AppConfig e) -> (AppConfig e -> Logger -> (Application -> IO ()) -> IO ()) -> IO ()Source
Run your app, taking environment and port settings from the commandline.
Use when using the provided fromArgs type, or
DefaultEnv when using a custom type
fromArgsWith
main :: IO () main = defaultMain fromArgs withMySite
or
main :: IO () main = defaultMain (fromArgsWith customArgConfig) withMySite
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
TODO: ifdef WINDOWS
defaultDevelApp :: (AppConfig DefaultEnv -> Logger -> (Application -> IO ()) -> IO ()) -> ((Int, Application) -> IO ()) -> IO ()Source
Run your development app using the provided type
DefaultEnv
withDevelAppPort :: Dynamic withDevelAppPort = toDyn $ defaultDevelApp withMySite
Arguments
| :: (Show e, Read e) | |
| => IO (AppConfig e) | A means to load your development |
| -> (AppConfig e -> Logger -> (Application -> IO ()) -> IO ()) | Your |
| -> ((Int, Application) -> IO ()) | |
| -> IO () |
Run your development app using a custom environment type and loader function
withDevelAppPort :: Dynamic withDevelAppPort = toDyn $ (defaultDevelAppWith customLoadAppConfig) withMySite