The http-pony-serve-wai package

[Tags:bsd3, library]

[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4
Change log ChangeLog.md
Dependencies attoparsec (>=0.13), base (==4.9.*), blaze-builder (>=0.4.0.2), bytestring (>=0.10), case-insensitive (>=1.2.0.7), http-pony-transformer-http (>=0.1.0.0), http-pony-transformer-startline (>=0.1.0.0), http-types (>=0.9.1), pipes (>=4.1), pipes-bytestring (>=2.1.3), pipes-safe (>=2.2.4), transformers (>=0.5.2), wai (>=3.2.1.1) [details]
License BSD3
Author Jinjing Wang
Maintainer nfjinjing@gmail.com
Category Network
Home page https://github.com/nfjinjing/http-pony-serve-wai
Uploaded Sat Sep 24 08:42:37 UTC 2016 by JinjingWang
Distributions NixOS:0.1.0.4
Downloads 118 total (4 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-09-24 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for http-pony-serve-wai

Readme for http-pony-serve-wai-0.1.0.4

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.