Don’t Forget About Proper Error Handling

Now that your server is talking to the world and you can see what’s going on there, we have another important topic to discuss—errors.

Due to the single-threaded nature of Node.js and the lack of default configuration, a single error could bring the entire application crashing down, something we definitely don’t want.

Error handling has been left in the hands of the programmers, and because of the nature of Node.js, it’s somewhat complicated to implement correctly.

Let’s investigate the various ways to address error handling in Node.js. There are several layers of implementation, and the best one to use would depend on the scale and nature of the application.

Keep the Process Alive

First, ...

Get Secure Your Node.js Web Application now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.