Welcome aboard! We are happy you are here and wish you good net-raft!
// express nodejs
app.use(function(err, req, res, next) {
// Do logging and user-friendly error message display
console.error(err);
res.status(500).send('internal server error');
})
const http = require('http');
var server1 = http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
res.write("Hello World");
res.end();
// throw new Error("Error!!!");
this.emit('error', new Error("Error!!!"));
});
server1.on("error", err=>console.log(err));
server1.listen(5060);
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 8.1K 1.7K