Member-only story
Debug Node.js Apps Using Google Chrome and Visual Studio Code
Debugging with superpowers

Debugging is an essential part of developing an application where you find and remove errors. In this blog, we are going to see how we can efficiently debug Node.js code by using Google Chrome browser’s DevTools and Visual Studio Code.
Many beginners use console.log()
to debug code which is not an efficient practice, as we need to add console.log again and again in the lines of code.
This makes us stop the application, add console.log, and start the application over again. This process creates unnecessary code and makes us less productive.
Debugging tools are a savior in this situation as they provide us with features like breakpoints, step in/out into functions, restart, and much more.
When necessary, we can pause the execution and inspect the variables/objects and then modify them without restarting our application at any point in time.
Using Google Chrome DevTools to Debug
Google Chrome comes with the default Node.js debugging tool, so it is preferable to use the latest version of Chrome.
To start debugging, let’s run our application with the --inspect-brk
flag.