Search code examples
node.jsnode-inspector

Node Inspector is Not Pausing on the Breakpoint


Currently, I am using Node V 9.3.0 and While debugging the node-inspector with Chrome Dev Tool, The request is not paused on the breakpoints, Can you please help me here

Steps to reproduce

  1. killall
  2. node node app.js
  3. node --inspect-brk app.js

I have below code line in the app.js

const users = require('./routes/users');
app.use('/users', users);

And I have below code in users.js

router.get('/profile', (req, res, next) => {
    res.send("User Profile");
});

Now I put the breakpoint on the line router.get('/profile', (req, res, next) => { and run page the with http://localhost:3000/users/profile , Page loads immediately without pausing. Can you please help me here


Solution

  • If you're interested in pausing before serving up the page, the breakpoint may need to be on the res.send("User Profile") line instead of the router.get... line