With the introduction of Microsoft Visual Studio Code, debugging of NodeJS application is now a quite simple procedure to follow
For example, suppose we have the following NodeJS super simple application
and we would like to debug it (although there is no much to debug)
I am assuming that you already installed Visual Studio Code from here (very short installation).
Now, Visual Studio Code should open and display the list of files under the current directory
Double click the app.js file, set a breakpoint using F9 and press F5
The debug settings will be opened
If your main file is app.js (as it is for our sample) you don’t need to change anything. Just press F5 again and VSCode will break into your code
That’s it !!!
It is quite amazing how simple you can start develop and debug applications with NodeJS. Think for a moment for the all steps that you need to complete in order to develop and debug application under the Java/.NET platforms
I think that Microsoft did quite an amazing job with VSCode.
BTW, VSCode is cross platform which means that the same process I just described above can be executed under Linux/Mac platforms. For example, go to Help | Toggle Developer Tools and you will see Chrome developer tools on the side
If you are wondering what is going on here you should read more details at the Electron project web site