1.0.0 • Published 2 years ago

coderr.client.expressjs v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

ExpressJS library for coderr.io

Coderr provides automated error reporting for ExpressJS-based applications.

this is a beta library, feel free to try it

npm.io

Register an account at https://lobby.coderr.io

Installation

Download this package:

npm -I coderr.client.expressjs

Import both the Coderr base library and the expressjs package:

import { err } from "coderr.client";
import { activatePlugin, errorMiddleware } from "coderr.client.expressjs";

// in the top of your app.js/ts
err.configuration.credentials("https://report.coderr.io", "yourAppKey", "yourSharedSecret");

// To configure the expressJS plugin.
activatePlugin(err);

// As the last middleware:
app.use(errorMiddleware);

Reporting slow queries.

You can report slow queries and/or all pages that generate 403 (Forbidden).

Add the coderrMiddleware for that:

import * as coderr from "coderr.client.expressjs";

// Either use this to set a limit to all HTTP verbs (in milliseconds)
coderr.requestTimeThreshold = 200;

// or do it per verb:
coderr.requestMethodTimeThresholds['post'] = 200;

// As the *first* middleware:
app.use(coderr.coderrMiddleware);

Reporting forbidden requests

You can report all requests that generate 403 forbidden:

import * as coderr from "coderr.client.expressjs";

coderr.reportForbidden = true;

// As the *first* middleware:
app.use(coderr.coderrMiddleware);

Further reading

Start with our getting started guide:

https://coderr.io/documentation/getting-started