#How to debug Nest JS app ?

24 messages · Page 1 of 1 (latest)

glad hedge
#

How to debug Nest JS app ?

atomic reef
#

With console.log or a debugger?

glad hedge
#

debugger

#

example - any links, screenshots related to it will help ..

  1. via command line
  2. via IDE
  3. via third party tool
  4. via any Debugger tool
atomic reef
#

What editor or IDE are you using?

glad hedge
#

visual code.

#

sometimes intellij

atomic reef
#

So, search in the Interwebs for "nodejs debugging with VSCode". Or, "nodejs debugggin with intellij".

short saffron
#

I mean, the nest start command has the--debug flag ready to be used to exposeand connect to a node debugger according to your debugger of choice. localhost port 9229 by default (node's default) and it should be pretty easy to just start and attach. VSCode also has the JavaScript Debug Terminal, which can auto attach to any node script. Have you tried to get debugging working? Are you facing issues? Or are you asking before attempting?

glad hedge
#
  1. DevTools
    npm i @nestjs/devtools-integration
    snapshot: true
    npm run start:dev
    https://docs.nestjs.com/devtools/overview

async function bootstrap() {
const app = await NestFactory.create(AppModule, {
snapshot: true,
});
await app.listen(3000);
}

  1. Rookout
    https://www.rookout.com/blog/debugging-nest-js-applications-examples-packages-config/

  2. VS Debugger
    https://dev.to/gentax/nestjs-right-settings-for-debugging-kl0
    "scripts": {
    ...
    "start:debug": "nest start --debug --watch",
    ...
    }
    npm run start:debug

Rookout

Get started with debugging Nest.js applications with this tutorial from Rookout, which offers architecture examples and tips on installation and configuration.

DEV Community

Bored to use a lot of console.log() in your Nestjs application? Want to become more productive and a...

#

I like the devtools-integration --> however it doesn't work ...not sure why. Does anyone has some more document or steps to use devtools-integration or step by step screenshot would help

short saffron
#

With regards to devtools "not working" doesn't tell us what's happening. It's also, if I recall correctly, not explicitly a debugging tool, it's a visual aid to help with the structure of your application.

glad hedge
#

i want to visual aid + debug + visual aid during debugging...that's what is my expectation

#

going through the flow in debugging mode via breakpoint is not that great in general

short saffron
glad hedge
#

javascript

short saffron
#

Nest is JavaScript.

glad hedge
#

Is it possible to visualize or visual aid using the above devtools using debugging. the links says we can do both...but not able to do so

short saffron
#

I don't see why you couldn't use the dev tools and the --debug flag at the same time, if that's what you're asking

#

But I don't think they'd integrate with each other in the way you want

glad hedge
#

any way to get the visual when we debug or during debug other than devtools ?

short saffron
#

I'm not even aware of that being a usual thing in most languages. The debugger steps through the code, you should have a mental model of what you're code execution flow looks like

atomic reef