express-page-error-middleware

2.0.4 • Public • Published

express-page-error-middleware

npm version Build Status codecov.io

Error pages handling middleware for express

Install

$ npm install --save express-page-error-middleware

Usage

Below is a example of usage. test/fixture/app.js also have a similar example.

var express = require('express');
var errorMiddleware = require('express-page-error-middleware');
 
var app = express();
 
// define your routes
 
// this will add a 404 error if the request is not handled before and render an error page
app.use(errorMiddleware('./templates/error.jade'));

Template

Variables provided inside the template.

  • code status code
  • detail message
  • error error object
  • stack error stack
  • url bind this e.g. while throwing an API error object err.url = apiRequest.url, to see what API url has caused it

/express-page-error-middleware/

    Package Sidebar

    Install

    npm i express-page-error-middleware

    Weekly Downloads

    1

    Version

    2.0.4

    License

    MIT

    Last publish

    Collaborators

    • antpaw