Preface
In the usual front-end development, the front-end code can be easily debugged with breakpoints in the browser. If you want to debug the node back-end interface, how to achieve breakpoint debugging?
Configuration
- vscode open the node project and click the debug button on the left
- Click Run and Debug
- Choose language as nodejs
- Click the Settings button to add configuration
- Change the lanuch.json configuration file
Add your own project startup script file and configuration
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "启动程序", "env": { "NODE_ENV": "development" }, "program": "${workspaceFolder}/bin/www" } ] } //program这个是我自己的node项目的启动文件
- Click the breakpoint debugging button again to start breakpoint debugging
- Click the startup program directly to start the breakpoint debugging
- Mark the breakpoint directly on the left side of the code where the breakpoint is needed, the execution method is to automatically start the breakpoint
- Then breakpoint step by step through the debug button above
- You can also see the data of the breakpoint by hovering the mouse
- Of course, you can also output the breakpoint data in the debug console. The result is equivalent to the console console where the browser breakpoint is
- If you want to end the breakpoint, click the pause button above
- The above is the entire vscode breakpoint configuration and breakpoint debugging tutorial
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。