Debugging Node/Express RESTful API with node-inspector Debugging Node/Express RESTful API with node-inspector express express

Debugging Node/Express RESTful API with node-inspector


Try with nodedev

1) Install nodedev:

sudo npm install -g nodedev

2) Start your server:

nodedev server.js

3) Visit the page http://127.0.0.1:7001/debug?port=7000 to debug...

4) ...

5) Profit!

Bonus: Your server will automatically restart when changes are detected!


Here is my solution: Do not use node-debug *.js directly. Instead, open two terminals in your project. For example, I want to debug server-3.js, like the pictures down here. In one terminal, use node-inspector for debugging listening, and another use node --debug server-3.js

enter image description here

enter image description here

after sending a request on postman:enter image description here

you can see your debugging situation in your node-inspector window listening on port 5858:

enter image description here

I believe this is what you want to achieve.

The latest update is that you can also resort to vscode, which has a plugin called "Debugger for Chrome" that has the debug function you want.

enter image description here


Use node-inspector instead of node-debug (comes in the same module)In one terminal execute:node-inspectorIn another terminal execute node --debug server.js