beakr (version 0.3.1)

handleErrors: Error-handling middleware

Description

This default error handler should be added at the end of the beakr pipeline, right before listen(). Errors generated by any previous step will be returned within a JSON wrapper.

The general structure for a stand-alone executable script with a beakr webservice typically looks like this:

newBeakr() 

httpGET(<route_A>, function(req, res, err) { ... })

httpGET(<route_B>, function(req, res, err) { ... })

serveStaticFiles(...)

handleErrors()

listen()

Usage

handleErrors(beakr = NULL)

Arguments

beakr

Beakr instance

Value

A Beakr instance with added middleware.