Module
HTTPure.Server
- Package
- purescript-httpure
- Repository
- cprussin/purescript-httpure
#serve Source
serve :: Int -> (Request -> ResponseM) -> Effect Unit -> ServerM
Create and start a server. This is the main entry point for HTTPure. Takes
a port number on which to listen, a function mapping Request
to
ResponseM
, and a ServerM
containing effects to run after the server has
booted (usually logging). Returns an ServerM
containing the server's
effects.
#serveSecure Source
serveSecure :: Int -> String -> String -> (Request -> ResponseM) -> Effect Unit -> ServerM
Create and start an SSL server. This method is the same as serve
, but
takes additional SSL arguments. The arguments in order are:
- A port number
- A path to a cert file
- A path to a private key file
- A handler method which maps
Request
toResponseM
- A callback to call when the server is up
#serveSecure' Source
serveSecure' :: Options SSLOptions -> ListenOptions -> (Request -> ResponseM) -> Effect Unit -> ServerM
Given a Options HTTPS.SSLOptions
object and a HTTP.ListenOptions
object, a function mapping Request
to ResponseM
, and a ServerM
containing effects to run on boot, creates and runs a HTTPure server with
SSL.