Changing sentry connection

This commit is contained in:
Julien Lengrand-Lambert
2025-02-02 19:37:21 +01:00
parent e373fd2086
commit 62d5fc6299
2 changed files with 10 additions and 6 deletions

View File

@@ -12,16 +12,11 @@ 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');
@@ -38,6 +33,11 @@ app.use(cors());
const routes = require('./routes/index.route');
app.use(routes);
const PORT = process.env.PORT || 3000;
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server is running on port ${PORT}`);
});
//start http server
const httpServer = http.createServer(app);
httpServer.listen(port);

View File

@@ -8,6 +8,9 @@
Copyright IBM Corporation 2020
*/
const Sentry = require("@sentry/node");
const express = require('express');
const cars = require('./cars.route');
const accounts = require('./accounts.route');
@@ -21,7 +24,8 @@ 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");
res.send('Error');
Sentry.captureException(new Error("Error Thrown on purpose to send it to Bugsink"));
});
router.get('/health', (req, res) => {