backends should work now (but untested)

This commit is contained in:
Dennis Frieberg 2020-09-23 20:48:03 +02:00
parent e74ab26b44
commit 04d9f063d4
6 changed files with 113 additions and 11 deletions

View file

@ -7,11 +7,40 @@ module Main where
-- 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 WaiApp
import Control.Concurrent.MVar
import Network.Wai.Handler.Warp
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
run 8080 $ waiApplication serverState
#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 ()