Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 2.34 KB

express.md

File metadata and controls

35 lines (25 loc) · 2.34 KB

Express

Express is a commonly-used package which adds a few key concepts on top of a Node http.Server. Notably, it defines a standard contract for "middleware" and "routing". Our wrapper around express is the fluid.express component (see below).

The Express request Object

Many of the handler and middleware grades in this package work directly with an Express request object (see their documentation). The Express request object is itself an extension of node's http.incomingMessage.

The Express response Object

Many of the handler and middleware grades in this package work directly with the response object provided by Express. The Express response object is itself an extension of node's http.ServerResponse.

fluid.express

This grade is a wrapper for the Express app itself. Although you can use routers and middleware written using this package without using this grade (see the router and middleware documentation for details), in most cases your fluid.express.router and fluid.express.middleware instances will perform their work within an instance of fluid.express.

To use this grade, you will generally need to wire in at least one fluid.express.router instance. You may also need one or more fluid.express.middleware instances.

Component Options

Option Type Description
port (required) {Number} The port express should listen on.
expressAppOptions {Object} Configuration options to be passed on to express via app.set. See the Express documentation for supported options. By default, the port is set to port (see above), and the default options for JSON.stringify as used within express itself are set to null and 2.