[๐ŸงฉNestjs] Controller

Aprilยท2022๋…„ 10์›” 22์ผ
0

๐ŸงฉNestJs

๋ชฉ๋ก ๋ณด๊ธฐ
3/6

1. Controller ๋ž€

  • Controller๋Š” ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ , ํด๋ผ์ด์–ธํŠธ์— response๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค
  • Controller๋Š” @Controller ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋กœ ํด๋ž˜์Šค๋ฅผ ๋ฐ์ฝ”๋ ˆ์ด์…˜ํ•˜์—ฌ ์ •์˜
  • ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋Š” ์ธ์ž๋ฅผ Controller์— ์˜ํ•ด์„œ ์ฒ˜๋ฆฌ๋˜๋Š” ๊ฒฝ๋กœ๋ฅผ ๋ฐ›๋Š”๋‹ค
  • Controller ์ƒ์„ฑ: ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•œ๋‹ค
nest g controller boards --no-spec

// controller ์ƒ์„ฑ ๋ช…๋ น์–ด: nest g controller boards --no-spec
// --no-spec: ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ์ฝ”๋“œ๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ฒ ๋‹ค

handler๋ž€?

  • ํ•ธ๋“ค๋Ÿฌ๋Š” @Get @Post @Delete ๋“ฑ๊ณผ ๊ฐ™์€ ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ๋กœ ์žฅ์‹๋œ ์ปจํŠธ๋กค๋Ÿฌ ํด๋ž˜์Šค ๋‚ด์˜ ๋‹จ์ˆœ ๋ฉ”์„œ๋“œ

profile
๐Ÿš€ ๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ์“ฐ๋Š” ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ

0๊ฐœ์˜ ๋Œ“๊ธ€