express uncaughtexception
const express = require('express');
const app = express();
process.on('uncaughtException', (err, origin) => {
console.error(`Uncaught Exception: ${err.message}`);
// Optionally, you can perform additional logging or error handling here
process.exit(1);
});
app.get('/', (req, res) => {
// Your route handling logic goes here
res.send('Hello, Express!');
});
const port = 3000;
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
});