Skip to content

Latest commit

 

History

History
189 lines (124 loc) · 3.47 KB

File metadata and controls

189 lines (124 loc) · 3.47 KB

Module Node.Express.App

AppM

data AppM e a

Monad responsible for application related operations (initial setup mostly).

Instances
Functor (AppM e)
Apply (AppM e)
Applicative (AppM e)
Bind (AppM e)
Monad (AppM e)
MonadEff eff (AppM eff)

App

type App e = AppM (express :: EXPRESS | e) Unit

makeHttpServer

makeHttpServer :: forall e1. App e1 -> ExpressM e1 Server

Create a Node.HTTP server from the Express application. HTTP version

makeHttpsServer

makeHttpsServer :: forall e1. App e1 -> ExpressM e1 Server

Create a Node.HTTP server from the Express application. HTTPS version

listenHttp

listenHttp :: forall e1 e2. App e1 -> Port -> (Event -> Eff e2 Unit) -> ExpressM e1 Server

Run application on specified port and execute callback after launch. HTTP version

listenHttps

listenHttps :: forall e1 e2 opts. App e1 -> Port -> opts -> (Event -> Eff e2 Unit) -> ExpressM e1 Server

Run application on specified port and execute callback after launch. HTTPS version

listenPipe

listenPipe :: forall e1 e2. App e1 -> Pipe -> (Event -> Eff e2 Unit) -> ExpressM e1 Server

Run application on specified named pipe and execute callback after launch. HTTP version

apply

apply :: forall e. App e -> Application -> ExpressM e Unit

Apply App actions to existent Express.js application

use

use :: forall e. Handler e -> App e

Use specified middleware handler.

useExternal

useExternal :: forall e. Fn3 Request Response (ExpressM e Unit) (ExpressM e Unit) -> App e

Use any function as middleware. Introduced to ease usage of a bunch of external middleware written for express.js. See http://expressjs.com/4x/api.html#middleware

useAt

useAt :: forall e. Path -> Handler e -> App e

Use specified middleware only on requests matching path.

useOnParam

useOnParam :: forall e. String -> (String -> Handler e) -> App e

Process route param with specified handler.

useOnError

useOnError :: forall e. (Error -> Handler e) -> App e

Use error handler. Probably this should be the last middleware to attach.

getProp

getProp :: forall e a. Decode a => String -> AppM (express :: EXPRESS | e) (Maybe a)

Get application property. See http://expressjs.com/4x/api.html#app-settings

setProp

setProp :: forall e a. Decode a => String -> a -> App e

Set application property. See http://expressjs.com/4x/api.html#app-settings

http

http :: forall e r. RoutePattern r => Method -> r -> Handler e -> App e

Bind specified handler to handle request matching route and method.

get

get :: forall e r. RoutePattern r => r -> Handler e -> App e

Shortcut for http GET.

post

post :: forall e r. RoutePattern r => r -> Handler e -> App e

Shortcut for http POST.

put

put :: forall e r. RoutePattern r => r -> Handler e -> App e

Shortcut for http PUT.

delete

delete :: forall e r. RoutePattern r => r -> Handler e -> App e

Shortcut for http DELETE.

all

all :: forall e r. RoutePattern r => r -> Handler e -> App e

Shortcut for http ALL (match on any http method).