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()
handleErrors(beakr = NULL)
Beakr instance
A Beakr
instance with added middleware.