VSCode - debugger not hitting break-point on postman request
11:12 15 Feb 2018

I'm building an express.js application that I'm testing using Postman. I haven't needed debugging until now, but I've just tried to set it up and run into a bit of an issue.

I followed this tutorial, but it isn't working for me as the end result of the tutorial shows that it should.

I built myself a launch.json file with a configuration built to handle running using nodemon...

"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "nodemon",
        "runtimeExecutable": "nodemon",
        "program": "${workspaceFolder}/app.js",
        "restart": true,
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen"
    },
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceFolder}\\bin\\www"
    }
]

I then started the debugger and got the following output in my terminal...

C:\Users\User\AppData\Roaming\npm\nodemon.cmd --inspect=35939 --debug-brk app.js

[nodemon] 1.14.11

[nodemon] to restart at any time, enter rs

[nodemon] watching: .

[nodemon] starting node --inspect=35939 --debug-brk app.js

Debugger listening on ws://127.0.0.1:35939/fca1b410-e096-4189-a5b2-bf266755e89e

For help see https://nodejs.org/en/docs/inspector

Debugger attached.

(node:24832) [DEP0062] DeprecationWarning: node --inspect --debug-brk is deprecated. Please use node --inspect-brk instead.

To test it out, I put a break-point on the very first line of my app.js file. The break-point was hit successfully.

I went into the router file and put a break-point inside the post method that I needed to debug...

//POST New Trip page//
router.post('/newtrip', function (req, res) {
    return tripCtrl.create(req, res); <---- BP on this line
});

I then ran the Postman request that I have been using to test this method:

(POST) http://localhost:3000/newtrip

I was fully expecting my new break-point to be hit, but the break-point wasn't hit, and I got no output from my debugger console or terminal. All I have is Postman returning 'Could not get any response'.

I'm well and truly lost as to where to go. Can anyone spot what might be wrong here please?

This is my file structure for the project:

project file structure

Thanks, Mark

node.js visual-studio-code postman