const express = require('express'); const HyperDX = require('../build/src'); HyperDX.init({ apiKey: '', service: 'hard-crash', }); // Crash immediately har(); // unhandledRejection // new Promise((resolve, reject) => { // reject(new Error('๐Ÿฆ„๐Ÿฆ„๐Ÿฆ„๐Ÿฆ„')); // }); const PORT = parseInt(process.env.PORT || '7788'); const app = express(); app.get('/uncaught', async (req, res) => { setTimeout(() => { throw new Error('๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฅ'); }, 2000); res.send('Uncaught exception in 2 seconds'); }); app.get('/crash', (req, res) => { throw new Error('๐Ÿงจ๐Ÿงจ๐Ÿงจ๐Ÿงจ'); }); app.get('/', (req, res) => { res.send('Hello World!'); }); // HyperDX.setupExpressErrorHandler(app); app.listen(PORT, () => { console.log(`Listening for requests on http://localhost:${PORT}`); });