-- with gracious thanks to mightybyte: -- http://softwaresimply.blogspot.com/2008_02_01_archive.html module Main where import HAppS.Server import Controller import Misc import System.Environment import Control.Concurrent import StateStuff import System.Time import HAppS.Server.Helpers main = do -- let p = 5001 let usageMessage = "usage example: happs-tutorial 5001 True (starts the app on port 5001, allows stress tests)" args <- getArgs case args of [port, allowStressTests] -> do p <- safeRead port allowStressTests <- safeRead allowStressTests smartserver (Conf p Nothing) "happs-tutorial" (controller allowStressTests) stateProxy otherwise -> do putStrLn usageMessage runInGhci = do putStrLn $ "happs tutorial running in ghci. \n" ++ "exit :q ghci completely and reenter ghci, before restarting." smartserver (Conf 5001 Nothing) "happs-tutorial" (controller True) stateProxy stateProxy :: Proxy AppState stateProxy = Proxy