Pradyuman
04/24/2024, 11:29 AMconst express = require('express');
const app = express();
function divide(a, b) {
if (b === 0) {
throw new Error('Division by zero error');
}
return a / b;
}
app.get('/', (req, res) => {
try {
const result = divide(10, 0);
console.log('Result:', result);
} catch (error) {
console.error('An error occurred:', error.message);
res.status(400).send('Bad Request: ' + error.message);
return;
}
res.send("Here is results of highest computed maths");
});
const port = 5000;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
Srikanth Chekuri
04/26/2024, 4:41 AMPradyuman
04/26/2024, 5:23 AMSigNoz is an open-source APM. It helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc.
Powered by