0.2.0 • Published 8 years ago
phantasy-http-server v0.2.0
phantasy-http-server
HTTP server library built with Phantasy
Server
createServer
:: (() -> EffTask fxa e) -> RequestHandler e fxb -> HttpServer fxa fxb e
Creates a new HttpServer
.
startServer
:: HttpServerOpts -> HttpServer fxa fxb e -> EffTask (fxa & fxb) void Error
Takes an options object and returns an EffTask
that succeeds with the start of the server or fails with an Error
.
Router
get
:: string -> RouteHandler e fx p q -> Route e fx p q
Creates a GET route that matches the given path.
post
:: string -> RouteHandler e fx p q -> Route e fx p q
Creates a POST route that matches the given path.
put
:: string -> RouteHandler e fx p q -> Route e fx p q
Creates a PUT route that matches the given path.
del
:: string -> RouteHandler e fx p q -> Route e fx p q
Creates a DELETE route that matches the given path.
mergeRoutes
:: Array (Routable e fx) -> Routable e fx
Takes an array of Routable
objects and merges them into a single Routable
object.
dispatch
:: Routable e fx -> RequestHandler e fx
Takes a Routable
and returns a RequestHandler
.
0.2.0
8 years ago