How to debug NestJs application on visual studio code

Published by geekwebcast@gmail.com on

In the Development stage, every application has some bugs/errors so every developer should be finding bugs in their code and making the code error-free. In this blog, we are going to discuss How to integrate debug tools in visual studio code (vs Code).

Step 1 : Create/ open your NestJs Application in VS code, The official document link First steps | NestJS – A progressive Node.js framework

Please make sure that your application is working properly

Step 2: Click on the Run and debug option or Open a folder option to create a launch.json file, Then please select the node js option from VS code prompted window

Step 3: Open launch.json file and paste below code

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "My application Name",
            "runtimeArgs": [
                "--nolazy",
                "-r",
                "ts-node/register"
            ],
            "args": [
                "${workspaceFolder}/src/main.ts"
            ],
            "autoAttachChildProcesses": true
        }
    ]
}

Step 4: Now you have successfully integrated debug tool for your NestJs application, Please click the play button on vs code. The application will run in debug mode

Happy coding !


0 Comments

Leave a Reply