# Starting from a WAI app {-# LANGUAGE OverloadedStrings #-} module Hello where import Network.HTTP.Pony.Serve.Wai (fromWAI) import qualified Network.HTTP.Types as HTTP import qualified Network.Wai as Wai waiApp :: Wai.Application waiApp request respond = do respond $ Wai.responseLBS HTTP.status200 [("Content-Type", "text/plain")] "Hello, WAI!" hello = fromWAI waiApp # Serve with pony {-# LANGUAGE OverloadedStrings #-} module RunHello where import Network.HTTP.Pony.Serve (run) import Network.HTTP.Pony.Transformer.HTTP (http) import Network.HTTP.Pony.Transformer.StartLine (startLine) import Network.HTTP.Pony.Transformer.CaseInsensitive (caseInsensitive) import Pipes.Safe (runSafeT) import Hello (hello) main :: IO () main = ( runSafeT . run "localhost" "8080" . http . startLine . caseInsensitive ) hello # Note * Streaming response is not implemented.