如何调试我的 adonis (nodejs) 框架 API?

Vik*_*ani 0 debugging dd node.js visual-studio-code adonis.js

我只是 NodeJS 中 adonis 框架的初学者,但我在 laravel 和 lumen 框架方面有很好的经验

在 laravel 和 lumen 框架 API 中,我使用dd() dump 和 die 来调试我的应用程序

但在AONIS框架中,我不知道如何调试我的API code

对于IDE = 我正在使用 Microsoft Visual Studio ( VS Code )

crb*_*ast 5

阅读此内容:https://code.visualstudio.com/docs/nodejs/nodejs-debugging(来自@damitj07)

总之 :

您需要创建新的 lauch.json,例如:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "node",
            "request": "launch",
            "cwd": "${workspaceFolder}/yourApp",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run-script",
                "debug"
            ],
            "port": 9229
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

并在 package.json 中添加新脚本,如下所示:

"scripts": {
    ...
    "debug": "node --nolazy --inspect-brk=9229 server.js"
  },
Run Code Online (Sandbox Code Playgroud)