How to use the @sentry/node.Handlers.requestHandler function in @sentry/node

To help you get started, we’ve selected a few @sentry/node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unwelch / unwel.ch / backend / src / server.js View on Github external
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
  throw err
})

db.init({
  user: process.env.DB_USER,
  host: process.env.DB_HOST,
  password: process.env.DB_PASSWORD,
  database: 'unwelch',
  port: process.env.DB_PORT
})

const app = express()
if (process.env.NODE_ENV === 'production') {
  app.use(sentryHandlers.requestHandler()) // The request handler must be the first middleware on the app
}
app.use(bodyParser.json())
app.use(cors())
app.use(passport.initialize())

passport.serializeUser((user, done) => {
  done(null, user)
})

passport.deserializeUser((user, done) => {
  done(null, user)
})

passport.use(googleStrategy)

app.get('/auth/google', googleAuthMiddleware)