Skip to content
jaham edited this page Mar 20, 2023 · 3 revisions

NestJs

NestJs๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ํ•„์š”ํ–ˆ๋˜ ํ…Œํฌ๋‹‰๋“ค์„ ๊ธฐ๋กํ•œ Wiki page ์ž…๋‹ˆ๋‹ค.

@ResolveField()

  • model์— ์ •์˜ํ•  ํ•„์š” ์—†์ด, Resolver์— ์ •์˜ํ•ด๋‘๋ฉด ์•Œ์•„์„œ ํ˜ธ์ถœ๋˜๊ณ , ์Šคํ‚ค๋งˆ์—๋„ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
  • ๋‹จ, ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ์— ์–ด๋–ค ํƒ€์ž…์„ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€ ๋ช…์‹œํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • 42Stat์—์„  ์—ฐ๊ด€๋œ ๋ฐ์ดํ„ฐ๋“ค์„ ๋ถˆ๋Ÿฌ์™€์ฃผ๋Š” ์šฉ๋„๋กœ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋ฐ˜ํ™˜ Type์„ Interface๋ฅผ ๋งŒ๋“ค์–ด์„œ ์ œ๊ณตํ•˜๋ฉด ์ถ”๊ฐ€์ ์ธ ํ™•์žฅ๋„ ๊ฐ€๋Šฅํ•ด๋ณด์ด๊ณ , ๋‹ค๋ฅธ ObjectType๊ณผ ๊ฐ™์€ ํƒ€์ž…์„ ๋ฐ˜ํ™˜ํ•˜๊ฒŒ ๋งŒ๋“ค๋ฉด ์ค‘์ฒฉ ์ฟผ๋ฆฌ๋„ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค.
    • ๋‹จ, ์ฟผ๋ฆฌ์˜ complexity๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ ๋ณด๋‹จ, ์• ์ดˆ์— ์ˆœํ™˜ ์ฐธ์กฐ๋ฅผ ์ œ๊ฑฐํ•œ ํ˜•ํƒœ๋กœ ๋งŒ๋“œ๋Š”๊ฒŒ ๋” ์ข‹์„ ๊ฒƒ์œผ๋กœ ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ์ˆ ์ ์œผ๋กœ๋Š” ์ˆœํ™˜ ์ฐธ์กฐ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

Mapped Type

  • Pick, Omit, Intersection ๊ฐ™์€ ๋™์ž‘์ด ObjectType์ด๋‚˜ InputType์— ๋Œ€ํ•ด์„œ ๋ชจ๋‘ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์ฝ”๋“œ ์–‘์„ ๋งŽ์ด ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Multiple endpoints

  • Nestjs ์—์„  GraphQL ๋กœ multiple endpoints ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š”๋ฐ, code first ์ ‘๊ทผ์œผ๋กœ๋Š” ์ด๊ฒƒ์ด ๋™์ž‘ํ•˜์ง€ ์•Š๋Š”๋‹ค.
  • Decorater๋ฅผ ์“ฐ๋Š” NestJs ์˜ ํŠน์ง•์œผ๋กœ ์ธํ•œ ๋ฌธ์ œ์ธ๋ฐ, ์ด Decorater๋“ค์€ typescript ์˜ ๊ธฐ๋Šฅ์ด๋ผ NestJs ์˜ ๋ชจ๋“ˆ ์‹œ์Šคํ…œ๊ณผ ์ž๋™์œผ๋กœ ํ˜ธํ™˜๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ์ด๋ฅผ NestJs ๊ฐœ๋ฐœ์ž๊ฐ€ ์˜ค๋ž˜์ „์— ์ธ์ง€ํ•˜์˜€์ง€๋งŒ, ์•„์ง๊นŒ์ง€ ๊ณ ์ณ์ง€์ง€ ์•Š๊ณ  ๋ฌธ์„œ๋„ ๊ฐฑ์‹ ๋˜์ง€ ์•Š์€ ์ƒํƒœ์ด๋‹ค...
  • https://github.com/nestjs/graphql/pull/1432