Configure Yesod Application as CGI

Given the newly created Yesod application for the forest, what is the minimum set of changes needed to get an executable that acts like a CGI program? The wrapper is acceptable. If the default executable created by cabal build is a CGI program, what environment variables must be set in order for it to act as a CGI (since by default it will bind to a port and try to serve requests there.)

A similar answer for FastCGI will also be appreciated.

+6
source share
1 answer

Update app/main.hs as follows:

 import Prelude (IO, (>>=)) import Yesod.Default.Config (fromArgs) import Yesod.Default.Main (defaultMain) import Settings (parseExtra) import Application (makeApplication) import Network.Wai.Handler.CGI (run) main :: IO () main = fromArgs parseExtra >>= makeApplication >>= run 

You need to add wai-extra to the dependencies in your cabal file. To use FastCGI instead, replace Network.Wai.Handler.CGI with Network.Wai.Handler.FastCGI and add wai-handler-fastcgi to the dependency list.

+7
source

All Articles