mirror of
https://github.com/jlengrand/sample-node-api.git
synced 2026-03-10 08:41:23 +00:00
Adds Sentry
This commit is contained in:
1708
package-lock.json
generated
1708
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,8 @@
|
||||
"author": "",
|
||||
"license": "EPL-2.0",
|
||||
"dependencies": {
|
||||
"@sentry/browser": "^8.53.0",
|
||||
"@sentry/node": "^8.53.0",
|
||||
"cors": "2.8.5",
|
||||
"express": "4.17.1",
|
||||
"swagger-ui-express": "4.2.0",
|
||||
|
||||
14
src/index.js
14
src/index.js
@@ -8,6 +8,20 @@
|
||||
Copyright IBM Corporation 2020
|
||||
*/
|
||||
|
||||
const Sentry = require("@sentry/node");
|
||||
|
||||
Sentry.init({
|
||||
dsn: "http://e1b49746a229427c9cbb8840bfbde82b@bugsink-rk08sow8w0gw0gk0w44kk08s.138.201.122.228.sslip.io/1",
|
||||
|
||||
// Alternatively, use `process.env.npm_package_version` for a dynamic release version
|
||||
// if your build tool supports it.
|
||||
release: "sample-node-api@1.0.0",
|
||||
|
||||
integrations: [],
|
||||
tracesSampleRate: 0,
|
||||
});
|
||||
|
||||
|
||||
const express = require('express');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
|
||||
@@ -20,6 +20,10 @@ router.use('/accounts', accounts);
|
||||
router.use('/', swagger);
|
||||
|
||||
router.get('/', (req, res) => res.send('Sample Node API Version1'));
|
||||
router.get('/error', (req, res) => {
|
||||
throw new Error("Error Thrown on purpose to send it to Bugsink");
|
||||
});
|
||||
|
||||
router.get('/health', (req, res) => {
|
||||
const healthcheck = {
|
||||
uptime: process.uptime(),
|
||||
|
||||
Reference in New Issue
Block a user