Monadic wrapper over Express web framework.
- Source:
Classes
- Component
- | Setting: { name: String, value: Any } | Plugin: { path: String, handler: (Request, ExpressRes, (Void → Void) → Void) } | Route: { method: String, spec: String|RegExp, handler: (Request → Future[Error, Response]) } | Engine: { extension: String, engine: (Path, Object, (Error, String → Void) → Void) }
- Content
- | Buffer: { value: Buffer } | Text: { value: String } | Value: { value: Any }
- Response
- | Redirect: { url: URL } | Render: { view: Path, options: Object } | Send: { status: Number, headers: Object, body: Content }
Methods
-
<static> all()
RouteSpec → (Request → Future[Error, Response]) → Component
-
Short-hand for
route('all')(...)
.- Source:
-
<static> buffer()
Buffer → Content
-
Constructs a Buffer body for a response.
- Source:
-
<static> create()
[Component] → Server
-
Constructs an Express server from a list of configurations.
- Source:
-
<static> disable()
Name → Component
-
Shor-hand for
set(name, false)
- Source:
-
<static> enable()
Name → Component
-
Shor-hand for
set(name, true)
- Source:
-
<static> engine()
String → (Path, Object, (Error, String → Void) → Void)
-
Constructs an engine configuration for an Express application.
- Source:
-
<static> fail()
String → Response
-
Short-hand for
send(500, { 'Content-Type': 'text/html' }, text(x))
- Source:
-
<static> json()
Object → Response
-
Constructs a JSON response.
- Source:
-
<static> listen()
Int → App → Future[Error, Server]
-
Binds an Express server to a particular port.
- Source:
-
<static> locals()
Object → Component
-
Constructs a locals configuration for an Express application.
- Source:
-
<static> notFound()
String → Response
-
Short-hand for
send(404, { 'Content-Type': 'text/html' }, text(x))
- Source:
-
<static> plugin()
Path → (Request, ExpressResponse, (Any → Void) → Void) → Component
-
Constructs a Plugin configuration for an Express application.
- Source:
-
<static> redirect()
URL → Response
-
Constructs a redirect response for a handler.
- Source:
-
<static> remove()
RouteSpec → (Request → Future[Error, Response]) → Component
-
Short-hand for
route('delete')(...)
.- Source:
-
<static> render()
String → Object → Response
-
Constructs a render response for a handler.
- Source:
-
<static> set()
Name → Value → Component
-
Constructs a configuration for an Express application.
- Source:
-
<static> success()
String → Response
-
Short-hand for
send(200, { 'Content-Type': 'text/html' }, text(x))
- Source:
-
<static> text()
String → Content
-
Constructs a String body for a response.
- Source:
-
<static> value()
Any → Content
-
Constructs a JS value body for a response.
- Source:
-
<static> wrap()
((Request → Future[Error, Response]) → (Request → Future[Error, Response])) → Component → Component
-
Wraps a route handler.
- Source:
-
<inner> route()
Method → RouteSpec → (Request → Future[Error, Response]) → Component
-
Constructs a Route configuration for an Express application.
This module also provides short-hands for HTTP verbs supported by Node.js, such that you can conveniently use
VERB(spec, handler)
instead ofroute(VERB, spec, handler)
.- Source:
-
<inner> send()
Int → Object → Content → Response
-
Constructs a response for a handler.
- Source: