mirror of
https://github.com/jlengrand/sample-node-api.git
synced 2026-03-10 08:41:23 +00:00
Changing sentry connection
This commit is contained in:
10
src/index.js
10
src/index.js
@@ -12,16 +12,11 @@ const Sentry = require("@sentry/node");
|
|||||||
|
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: "http://e1b49746a229427c9cbb8840bfbde82b@bugsink-rk08sow8w0gw0gk0w44kk08s.138.201.122.228.sslip.io/1",
|
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",
|
release: "sample-node-api@1.0.0",
|
||||||
|
|
||||||
integrations: [],
|
integrations: [],
|
||||||
tracesSampleRate: 0,
|
tracesSampleRate: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
@@ -38,6 +33,11 @@ app.use(cors());
|
|||||||
const routes = require('./routes/index.route');
|
const routes = require('./routes/index.route');
|
||||||
app.use(routes);
|
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
|
//start http server
|
||||||
const httpServer = http.createServer(app);
|
const httpServer = http.createServer(app);
|
||||||
httpServer.listen(port);
|
httpServer.listen(port);
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
Copyright IBM Corporation 2020
|
Copyright IBM Corporation 2020
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const Sentry = require("@sentry/node");
|
||||||
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const cars = require('./cars.route');
|
const cars = require('./cars.route');
|
||||||
const accounts = require('./accounts.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('/', (req, res) => res.send('Sample Node API Version1'));
|
||||||
router.get('/error', (req, res) => {
|
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) => {
|
router.get('/health', (req, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user