46 lines
1.1 KiB
Haskell
46 lines
1.1 KiB
Haskell
module Main where
|
|
|
|
-- TODO:
|
|
-- We need some logic to compile with different backends. Right now we only
|
|
-- support warp. But a (fast) cgi backend would be nice too.
|
|
|
|
-- TODO:
|
|
-- We need some way too configure things, like the port we run on.
|
|
-- see Network.Wai.Handler.Warp.Settings and Network.Wai.Handler.Warp.runSettings
|
|
|
|
import Control.Concurrent.MVar
|
|
import WaiApp
|
|
|
|
#ifdef HTTP_SUPPORT
|
|
import qualified Network.Wai.Handler.Warp as HTTP
|
|
#endif
|
|
|
|
#ifdef HTTPS_SUPPORT
|
|
import qualified Network.Wai.Handler.WarpTLS as HTTPS
|
|
import qualified Network.Wai.Handler.Warp as HTTP
|
|
#endif
|
|
|
|
#ifdef FASTCGI_SUPPORT
|
|
import qualified Network.Wai.Handler.FastCGI as FastCGI
|
|
#endif
|
|
|
|
#ifdef CGI_SUPPORT
|
|
import qualified Network.Wai.Handler.CGI as CGI
|
|
#endif
|
|
|
|
main :: IO ()
|
|
main = do
|
|
serverState <- newMVar newServerState
|
|
#ifdef HTTP_SUPPORT
|
|
HTTP.runSettings HTTP.defaultSettings $ waiApplication serverState
|
|
#endif
|
|
#ifdef HTTPS_SUPPORT
|
|
HTTPS.runTLS HTTPS.defaultTlsSettings HTTP.defaultSettings $ waiApplication serverState
|
|
#endif
|
|
#ifdef FASTCGI_SUPPORT
|
|
FastCGI.run $ waiApplication serverState
|
|
#endif
|
|
#ifdef CGI_SUPPORT
|
|
CGI.run $ waiApplication serverState
|
|
#endif
|
|
return ()
|