Created
August 22, 2013 10:04
-
-
Save ostronom/6305409 to your computer and use it in GitHub Desktop.
hello-world wai-warp server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Network.Wai.Handler.Warp (run) | |
| import qualified Routes as R | |
| main = do | |
| run 3000 R.routes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Project | |
| version: 1.0.0 | |
| build-type: Simple | |
| cabal-version: >= 1.2 | |
| license: MIT | |
| author: Author | |
| homepage: http://example.com | |
| category: Testing | |
| synopsis: synopsis | |
| executable main | |
| main-is: Main.hs | |
| hs-source-dirs: src | |
| build-depends: base >= 4 && < 5 | |
| , conduit >= 1 && < 1.1 | |
| , http-types >= 0.8 && < 1 | |
| , wai >= 1.4 && < 1.5 | |
| , warp >= 1.3 && < 1.4 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| module Routes where | |
| import Network.Wai | |
| import Network.HTTP.Types (ok200) | |
| import Data.Conduit | |
| routes :: Request -> ResourceT IO Response | |
| routes req = return $ responseLBS ok200 [] "OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment