A server handler for WAI which wraps node's http module.
This library is not yet published to pursuit.
You can install this package by adding the details below to your packages.dhall:
let additions =
{ warp =
{ dependencies = [ "console", "effect", "generics-rep", "node-fs-aff", "node-http", "wai" ]
, repo = "https://github.com/Woody88/purescript-warp.git"
, version = "master"
}
, wai =
{ dependencies = [ "aff", "effect", "http-types", "node-net" ]
, repo = "https://github.com/Woody88/purescript-wai.git"
, version = "master"
}
, http-types =
{ dependencies = [ "tuples", "unicode", "generics-rep" ]
, repo = "https://github.com/Woody88/purescript-http-types.git"
, version = "master"
}
}
user@user:~$ spago install warp
import Prelude
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Class.Console as Console
import Network.HTTP.Types (ok200)
import Network.HTTP.Types.Header (hContentType)
import Network.Wai (Application, responseStr)
import Network.Warp.Run (runSettings)
import Network.Warp.Settings (defaultSettings)
main :: Effect Unit
main = do
let beforeMainLoop = Console.log $ "Listening on port " <> show defaultSettings.port
void $ runSettings defaultSettings { beforeMainLoop = beforeMainLoop } app
app :: Application
app req f = do
f $ responseStr ok200 [(hContentType /\ "text/plain")] "Hello, World!"
If you are interested in fixing issues and contributing directly to the code base, please see the contributing guidelines.
Change log details can be found here
Licensed under the MIT license. Copyright (c) 2021 Woodson Delhia. All rights reserved.