Module

Node.Express.App

Package
purescript-express
Repository
nkly/purescript-express

#AppM Source

data AppM e a

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

Instances

#App Source

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

#listenHttp Source

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

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

#listenHttps Source

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

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

#listenHostHttp Source

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

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

#listenHostHttps Source

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

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

#listenPipe Source

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

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

#makeHttpServer Source

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

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

#makeHttpsServer Source

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

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

#apply Source

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

Apply App actions to existent Express.js application

#use Source

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

Use specified middleware handler.

#useExternal Source

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 Source

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

Use specified middleware only on requests matching path.

#useOnParam Source

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

Process route param with specified handler.

#useOnError Source

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

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

#getProp Source

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

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

#setProp Source

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

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

#http Source

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

Bind specified handler to handle request matching route and method.

#get Source

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

Shortcut for http GET.

#post Source

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

Shortcut for http POST.

#put Source

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

Shortcut for http PUT.

#delete Source

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

Shortcut for http DELETE.

#all Source

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

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