nest.js setup vscode debuger code example

Example: nestjs vscode debug

.vscode/launch.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": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach NestJS WS",
      "port": 9229,
      "restart": true,
      "stopOnEntry": false,
      "protocol": "inspector"
    }
  ]
}
and in package.json (Nest new CLI commands, requires 6.8.x)

{
  "name": "nest-app",
  "scripts": {
    "start:debug": "nest start --debug --watch"
  }
}