How can i debugging my adonis ( nodejs ) framework APIs?

二次信任 提交于 2021-01-29 13:37:28

问题


I'm just beginner in adonis framework in NodeJS but I have a good experience in laravel and lumen framework

in laravel and lumen framework APIs I use dd() dump and die to debugging my app

but in the AONIS framework, I don't know how to debug my API code.

for IDE = I'm using Microsoft visual studio ( VS Code )


回答1:


Read this : https://code.visualstudio.com/docs/nodejs/nodejs-debugging (from @damitj07)

In summary :

You need to create new lauch.json like:

{
    // 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
        }
    ]
}

and add new script in your package.json like:

"scripts": {
    ...
    "debug": "node --nolazy --inspect-brk=9229 server.js"
  },


来源:https://stackoverflow.com/questions/58832298/how-can-i-debugging-my-adonis-nodejs-framework-apis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!