hack2-interface-wai: Hack2 interface to WAI

[ bsd3, library, web ] [ Propose Tags ]

Convert a Hack2 App to a WAI app

[Skip to Readme]
Versions [RSS] [faq] 2012.5.24, 2012.5.25, 2017.1.4
Change log changelog.md
Dependencies base (>=4.8 && <5), bytestring, case-insensitive, containers, data-default (>=0.2), hack2 (>=2011.6.20), http-types, network, safe, wai [details]
License BSD-3-Clause
Author Jinjing Wang
Maintainer Jinjing Wang <nfjinjing@gmail.com>
Category Web
Home page https://github.com/nfjinjing/hack2-interface-wai
Uploaded by JinjingWang at 2017-01-04T09:22:01Z
Distributions NixOS:2017.1.4
Downloads 2295 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-01-04 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees


Readme for hack2-interface-wai-2017.1.4

[back to package description]

Interfacing Hack2 and Wai

Example: test/hello

{-# LANGUAGE OverloadedStrings #-}

import Hack2 
import Hack2.Interface.Wai (hackAppToWaiApp)
import Data.Default (def)
import Network.Wai.Handler.Warp (run)

app :: Application
app = \env -> 
  return $ 
      Response 200 [ ("Content-Type", "text/plain") ] "Hello World (Hack2 to Wai)"

main :: IO ()
main = do
    putStrLn $ "http://localhost:3000/"
    run 3000 (hackAppToWaiApp app)