我只是NodeJS中adonis框架的初学者 但我在laravel和lumen框架方面有丰富的经验
在laravel和lumen框架API中,我使用dd()
dump and die 调试我的应用程序
但是在AONIS框架中,我不知道如何调试我的API code
。
对于 IDE =我正在使用microsoft Visual Studio( VS Code )
阅读: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
}
]
}
并在package.json中添加新脚本,例如:
"scripts": {
...
"debug": "node --nolazy --inspect-brk=9229 server.js"
},