In this article I’ll be sharing some of my level-up experience learning how to debug node.js apps. It was not easy at first, but once I got it, I felt empowered that now I can work with any code base.
Debugging is useful for solving vague problems in other people’s code and it’s also useful for learning how something actually works. The article might be particularly useful for those used to having debugger experience in WebStorm or similar IDEs.
That article is meant to be more like a cheat sheet rather than too detailed step by step guide, here’s a go-to list of techniques:
Let’s start by the basics — using the node’s native debugger.
For example, this app contains a simple server returning a JSON object which is a swagger specification and I need to debug and see its value. So, in this example, I’ll follow this steps to see the contents of the variable:
debugger
node debug example/app.js
c
to continue and n
for nextrepl
to execute some code which access current state of the systemThis is an experimental feature.
This feature actually worked for me, I felt just the same way when I made my first animality in MK3.
In fact it’s almost identical to debugging a simple script, the only detail you have to notice is an input box where you put the actual command as if ran in the command line.