Global

Type Definitions

Middleware(req, res, next)

A Connect-style middleware function. It either responds to the request by writing to res, or calls next to pass control to the next middleware in the stack.

Parameters:
Name Type Description
req http.IncomingMessage

The incoming request, a Node.js http.IncomingMessage. Its url is relative to the path the middleware was mounted on.

res http.ServerResponse

The response, a Node.js http.ServerResponse. Write to it (e.g. res.writeHead(...) then res.end(...)) to handle the request.

next function

Passes control to the next middleware. Call it with no arguments to continue; call it with an Error to abort the stack and respond with HTTP 500. If no middleware handles the request, the server responds with HTTP 404.