[Debug] How to Debug a NestJs Backend using the Chrome Dev Tools

TO debug NestJS code with Chrome dev tool, we can run:node

node --inspect-brk dist/rest-api/src/main.js

 

TO make it easier for us running this later, we can do:chrome

"start:debug": "tsc-watch -p tsconfig.build.json --onSuccess \"node --inspect-brk dist/rest-api/src/main.js\"",

 

After running this script, you cannot see the endpoint running, this is becasue we need to attach chrome dev tool.json

To do that, open a new tab in Chrome,api

chrome://inspect

THis helps to attach the chrome dev tool to our NestJS backend.ui

 

Then we can reopen the endpoint in tab, we can do the normal debugging as we did in Front end.this

相關文章
相關標籤/搜索