Starting the Debugger for Web Services In Node

Last week, I focused on developing and deploying the front (see here). This week, I started to work on the back-end web services. We all have our own unique way of diving into and learning new things. For me, when it comes to learning software, I find myself heavily rely on the ability to step through the codes in the debugger.

Of course in order to debug web services, you also need a “client” to call your web services. To achieve that, you can either develop dedicated front end applications that calls your web services. Or you can use tools such as postman to call your web services through POST/GET, etc. For the current post, we will focus only on how to launch the debugger assuming that some clients will be calling the web services.

Here’re two alternative options I found useful to start the debugger for web services developed in node.

Select “node” in the initial setup. Visual studio code will launch your node server in the debug mode. From there, you have all the usual debugging functionalities available for you, e.g. setting up break points, step through/in/out, inspecting call stack, etc.

If you to use Chrome or other tools to debug, you can also change node script in package.json to add the “- - inspect” option, e.g.

“scripts”: {

“start”: “node — inspect index.js”


You can then do “npm start” and start your server as usual (but with debugger listening in the default port of 9229).

> node — inspect index.js

Debugger listening on ws://–474a-8bf2-a009fe7f858b

From there, you have two options:

Option 1: go to chrome://inspect and click Configure, add the Once the node appears in the Target list, click “inspect” and it will launch the chrome devtools where you can add your folder and start debugging.

Option 2: go to and copy the devtoolsFrontendUrl from the output. You can past it in the chrome browser (chrome-devtools://devtools/bundled/XXX see below for the full command) and that will launch the devtools as well.

"devtoolsFrontendUrl": "chrome-devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=",

I am sure there’re other tools and approaches to debug web services. Whichever you prefer, debugger is not just for debugging issues but also an effective learning tool.

beginning a new journey by launching my own startup in the middle of the pandemic. I am passionate about sharing my learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store