1
0
Fork 0

Initial commit

This commit is contained in:
Vojtěch Mareš 2023-09-26 21:43:36 +00:00
commit 7724a7614e
24 changed files with 1653 additions and 0 deletions

38
app/server.js Normal file
View file

@ -0,0 +1,38 @@
const express = require('express')
const sentry = require('@sentry/node')
const tracing = require('@sentry/tracing')
const app = express()
const PORT = process.env.PORT || 3000
const SENTRY_DSN = process.env.SENTRY_DSN
sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
})
app.get('/hello', (req, res) => {
res.send('World')
})
app.get('/exception', (req, res) => {
try {
throw new Error('Something flew out of a window')
} catch(e) {
sentry.captureException(e)
res.status(500).end()
}
})
app.get('/uncaught-exception', (req, res) => {
throw new Error('Something flew out of a window')
})
app.get('/error-message', (req, res) => {
sentry.captureMessage('Something went wrong')
req.status(500).end()
})
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server listening on http://0.0.0.0:${PORT}`)
})