An open API service indexing awesome lists of open source software.

https://github.com/lependu/express-error-handler

Experimental error handler middleware for express applications
https://github.com/lependu/express-error-handler

Last synced: 8 months ago
JSON representation

Experimental error handler middleware for express applications

Awesome Lists containing this project

README

          

Experimental error handler for express.js projects.

### Usage

`$ npm i git+https://github.com/lependu/express-error-handler.git [--save]`

```JSON
{
dependencies: {
"express-error-handler": "git+https
}
}
```Javascript
import express from 'express';
import bodyParser from 'body-parser';
import { notFound, errorHandler } from 'express-error-handler';

// ...

const app = express();

const { json } = bodyParser;

app.use(json());

// ...

// These two middlewares has to be the last ones.
app.use(notFound);
app.use(errorHandler);

app.listen(3000);

export default app;
```

### Tests
`$ npm run lint`

`$ npm run test`

`$ npm run coverage`
See the generated `coverage` directory.