phantasy-http-server

0.2.0 • Public • Published

phantasy-http-server

Build Status

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.

Readme

Keywords

Package Sidebar

Install

npm i phantasy-http-server

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • tkuminecz