@carisls/sentry-node

0.3.1 • Public • Published

Sentry Node (Express)

Introduction

NPM Version NPM Downloads Install Size

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());

Readme

Keywords

Package Sidebar

Install

npm i @carisls/sentry-node

Weekly Downloads

49

Version

0.3.1

License

MIT

Unpacked Size

4.39 kB

Total Files

4

Last publish

Collaborators

  • mstrujic-caris
  • michaelortho