The tutorial demonstrates connecting a VS Code debugger to NestJS microservices running in Docker. It covers configuring package scripts and Docker Compose, creating a launch.json file for the debugger, attaching to the container, and stepping through code with breakpoints to inspect variables and control flow.
Length 8:26
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #debugging #docker #nestjs #vscode #microservices #containerization #software-development #breakpoints #nodejs
0:00 All right, so in this lecture, I want to show you how we can actually 0:03 connect a 0:04 debugger to our running microservices in 0:08 Docker so that when we send a request to our 0:11 microservices, we can actually debug it and see 0:16 our defined variables and our control flow as the 0:20 request actually enters our HTTP server. 0:23 This can be super useful when debugging and trying to find out what 0:27 our code 0:27 is actually doing, and it's gonna be super easy to debug 0:31 with NestJS. So let's get started by firstly 0:35 going into our package JSON, where we need to update our 0:39 scripts. So right now you can see we actually 0:42 already have a 0:43 command to start in debug mode. So this is start debug, 0:47 and this is just gonna use a Nest CLI to start the app still with the 0:51 watch flag so we can make changes, but also with this debug flag. 0:55 So the debug flag allows us to actually enter debug mode 0:59 and specify an address where we want to listen 1:03 for debug requests. So in our case, I wanna go ahead and 1:07 specify this address. So the IP is gonna be zero 1:11 zero zero zero so that we attach to all 1:15 network interfaces running. Well, in our case, we know our app is 1:19 running inside of a Docker container, so we wanna listen on all 1:23 IP addresses in that container, and we want to specifically 1:27 then listen on port nine two two nine, which is 1:30 gonna be the debugging port we're gonna use. 1:34 So now we've specified the debug command. 1:36 We now need to go into our Docker Compose, and 1:40 now we need to actually change the command that our services are 1:44 using to actually start up the application. 1:48 As of right now, we're simply running the start dev
The rest of the transcript is for members.
Sign in