Ozten Recent Activities

Home › Items tagged with cgi

  • ozten: hello world in CGI FastCGI and Happstack FastCGI

    I made sure your Haskell CGI and FastCGI setup is working. Here are Hello World CGI, Fast-CGI, and Happstack on FastCGI

    • Tags:
    • haskell
    • haskwhal
    • cgi
    • fastcgi
    • fcgi
    • learning
  • hello world in CGI FastCGI and Happstack FastCGI

    Just as a sanity check for Help! Can you run Happstack as a CGI? I made sure your Haskell CGI and FastCGI setup is working.CGI -- ghc --make -o CgiPlay.cgi CgiPlay.hs import Network.CGI

    cgiMain :: CGI CGIResult cgiMain = output "Hello World!"

    main :: IO () main = runCGI (handleErrors cgiMain) FastCGI -- ghc -package fastcgi -threaded --make -o FCgiPlay.fcgi FCgiPlay.hs import Control.Concurrent import System.Posix.Process (getProcessID)

    import Network.FastCGI

    test :: CGI CGIResult test = do setHeader "Content-type" "text/plain" pid <- liftIO getProcessID threadId <- liftIO myThreadId let tid = concat $ drop 1 $ words $ show threadId output $ unlines [ "Process ID: " ++ show pid, "Thread ID: " ++ tid]

    main = runFastCGIConcurrent' forkIO 10 test Happstack on FastCGI import Happstack.Server.FastCGI import Happstack.Server.SimpleHTTP (askRq, getData, RqData, ToMessage) import Happstack.Server (look, fromData, FromData, simpleHTTP, Conf(..), toResponse, ServerPartT)

    simpleCGI :: (ToMessage a) => ServerPartT IO a -> IO () simpleCGI = runFastCGIConcurrent 10 . serverPartToCGI

    main = simpleCGI handleRequest

    handleRequest = return $ toResponse "Howdy From Happstack on FastCGI"

    • Tags:
    • haskell
    • haskwhal
    • cgi
    • fastcgi
Copyright © 2012 Me. All Rights Reserved. Running on Sweetcron v1.08e

This site is monitored by mon.itor.us