@carisls/sentry-node
v0.3.1
Published
Dependency to enable sentry with standard settings
Downloads
250
Readme
Sentry Node (Express)
Introduction
This is a simple tool to add Sentry monitoring to any project built in NodeJS Express.
How to add to your application?
Add this code after you initialize express app.
// Initialize Express app
const express = require('express');
const app = express();
// Add Sentry
const sentryNode = require('@carisls/sentry-node');
sentryNode({
dsn: process.env.SENTRY_DSN
}, app);
If you want to use more settings, you can do it this way
// Initialize Express app
const express = require('express');
const app = express();
// Add Sentry
const sentryNode = require('@carisls/sentry-node');
sentryNode({
dsn: process.env.SENTRY_DSN,
sampleRate: process.env.SENTRY_SAMPLE_RATE, // defaults to 1.0
profilingRate: process.env.SENTRY_PROFILING_RATE, // defaults to 1.0
env: process.env.SENTRY_ENV // defaults to local
release: process.env.GIT_SHA // optional code version
beforeSend: () => {...} // optional callback for sanitizing before send
}, app);
// Application code
// ...
// Sentry Error handler
app.use(sentry.errorHandler());