๐ŸŽ‰ berenickt ๋ธ”๋กœ๊ทธ์— ์˜จ ๊ฑธ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. ๐ŸŽ‰
Back
NestJs
10-Debugger

1. VSCode ๋””๋ฒ„๊ฑฐ

VSCode ์˜†์— ์‹คํ–‰ ๋ฐ ๋””๋ฒ„๊ทธ๋ฅผ ๋ˆŒ๋Ÿฌ์„œ create a launch.json file๋ฅผ ํด๋ฆญํ•œ๋‹ค.

(1) Node.js๋ฅผ ์„ ํƒ

1
// .vscode/launch.json
2
{
3
// IntelliSense๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ€๋Šฅํ•œ ํŠน์„ฑ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์„ธ์š”.
4
// ๊ธฐ์กด ํŠน์„ฑ์— ๋Œ€ํ•œ ์„ค๋ช…์„ ๋ณด๋ ค๋ฉด ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค.
5
// ์ž์„ธํ•œ ๋‚ด์šฉ์„ ๋ณด๋ ค๋ฉด https://go.microsoft.com/fwlink/?linkid=830387์„(๋ฅผ) ๋ฐฉ๋ฌธํ•˜์„ธ์š”.
6
"version": "0.2.0",
7
"configurations": [
8
{
9
"type": "node",
10
"request": "launch",
11
"name": "Debug NestJS",
12
"runtimeExecutable": "yarn",
13
// ์‚ฌ์šฉํ•  package.json ๋ช…๋ น์–ด
14
"runtimeArgs": ["start:debug"],
15
// vscode ์ƒ์˜ ํ„ฐ๋ฏธ๋„ ์‚ฌ์šฉ
16
"console": "integratedTerminal",
17
"restart": true,
18
// NestJS ๊ธฐ๋ณธ ๋””๋ฒ„๊ทธ ํฌํŠธ 9229
19
"port": 9229,
20
// ๋””๋ฒ„๊ฑฐ๋ฅผ ์ž๋™์œผ๋กœ ํ”„๋กœ์„ธ์Šค์— ๋ถ™์„์ง€ ๋ง์ง€
21
"autoAttachChildProcesses": true
22
}
23
]
24
}

(2) ๋ชจ๋‹ˆํ„ฐ๋งํ•  ๊ณณ์— ๋ธŒ๋ ˆ์ดํฌ ํฌ์ธํŠธ๋ฅผ ์„ค์ •ํ•˜๊ณ , ์‹คํ–‰ ๋ฐ ๋””๋ฒ„๊ทธ ๋ฒ„ํŠผ ํด๋ฆญํ•œ๋‹ค.

  • VScode์— ๋ธŒ๋ ˆ์ดํฌ ํฌ์ธํŠธ๋ฅผ ์ฐ์€ ๊ณณ์—์„œ ๋ฉˆ์ถ˜๋‹ค.
  • ์Šคํƒญ์ธํˆฌ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ํ•œ ์ค„ ์”ฉ ๋ฉˆ์ถ”๋ฉด์„œ ์ง„ํ–‰์ƒํ™ฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.