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

2023-04-27,,

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

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

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

"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.

To do that, open a new tab in Chrome,

chrome://inspect

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

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

[Debug] How to Debug a NestJs Backend using the Chrome Dev Tools的相关教程结束。

《[Debug] How to Debug a NestJs Backend using the Chrome Dev Tools.doc》

下载本文的Word格式文档,以方便收藏与打印。