Skip to content

peer session week3

Dongmin Kim edited this page Nov 12, 2021 · 4 revisions

ํ”ผ์–ด์„ธ์…˜

Week3

client ์ƒํƒœ ๊ด€๋ฆฌ

  • recoil(atom, selector)
    • ๋กœ๊ทธ์ธ๋œ ์œ ์ €์˜ ์ƒํƒœ ๊ด€๋ฆฌ(์œ ์ € ๋ช…, ํ”„๋กœํ•„ ์ด๋ฏธ์ง€)
    • atom, recoilState

server ์ƒํƒœ ๊ด€๋ฆฌ

  • react query
    • useQuery
    • useMutation
      • ์„œ๋ฒ„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋Š” ์š”์ฒญ

์ธ์ฆ ์ถ”์ƒํ™”(passport)

  • jwtํ† ํฐ ์ •์ฑ…์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž ์ธ์ฆ

    • ํšŒ์›๊ฐ€์ž…๊นŒ์ง€ ์ง„ํ–‰ํ•œ ์œ ์ € ์ธ์ฆ ์ •์ฑ…
    • ํšŒ์›๊ฐ€์ž…์€ ํ•˜์ง€ ์•Š์€ ์œ ์ € ์ธ์ฆ ์ •์ฑ…
  • Oauth ๋ฅผ ํ†ตํ•ด Socials ์—ฐ๋™

    • Google
    • GitHub
    • Tistory
    • (Kakao)

mongoDB

  • ๋ฐ์ดํ„ฐ ๋ชจ๋ธ๋ง

    • ์ž„๋ฒ ๋“œ ๋ฐฉ์‹ ๊ด€๊ณ„๋ฅผ ๊ฐ–๋Š” ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋‹จ์ผ ๋„ํ๋จผํŠธ์— ํฌํ•จํ•˜์—ฌ ์ €์žฅํ•˜๋Š” ๋ฐฉ์‹

    • ๋ ˆํผ๋Ÿฐ์Šค ๋ฐฉ์‹ ๋„ํ๋จผํŠธ์— ๊ด€๊ณ„๋ฅผ ๊ฐ–๋Š” ๋‹ค๋ฅธ ๋„ํ๋จผํŠธ์˜ ์‹๋ณ„์ž๋ฅผ ์ฐธ์กฐํ‚ค

  • Multi-Key index๋ฅผ ํ†ตํ•œ ํƒœ๊ทธ ์ž๋™ ์™„์„ฑ

    • ์ดˆ์„ฑ / ์ดˆ์„ฑ+์ค‘์„ฑ+์ข…์„ฑ์˜ ํƒœ๊ทธ ๊ธฐ๋ฐ˜ ๊ฒ€์ƒ‰ ํšจ์œจ ํ–ฅ์ƒ

      • ํ•˜๋‚˜์˜ Query ์—์„œ ๋‘๊ฐœ ์ด์ƒ์˜ Index ๋ฅผ ์ ์šฉํ•˜๋Š” ๋ฐฉ์‹ $or ์‚ฌ์šฉ image

      When evaluating the clauses in the $or expression, MongoDB either performs a collection scan or, if all the clauses are supported by indexes, MongoDB performs index scans. That is, for MongoDB to use indexes to evaluate an $or expression, all the clauses in the $or expression must be supported by indexes. Otherwise, MongoDB will perform a collection scan.

      • MongoDB Index ๋Š” $regex(like) ์—ฐ์‚ฐ ์—ญ์‹œ index ๊ฐ€ ์ ์šฉ

      For case sensitive regular expression queries, if an index exists for the field, then MongoDB matches the regular expression against the values in the index, which can be faster than a collection scan. Further optimization can occur if the regular expression is a "prefix expression", which means that all potential matches start with the same string. This allows MongoDB to construct a "range" from that prefix and only match against those values from the index that fall within that range.

  • Validate

    • Reference Object ID ์œ ํšจ์„ฑ ๊ฒ€์‚ฌํ•˜๋Š” Validator
    • ์œ ํšจํ•œ URL ์„ ๊ฒ€์‚ฌํ•˜๋Š” Validator
    • ์œ ํšจํ•œ Email ์„ ๊ฒ€์‚ฌํ•˜๋Š” Validator
    • ์ˆซ์ž์˜ ์ž๋ฆฟ์ˆ˜๋ฅผ ๊ฒ€์‚ฌํ•˜๋Š” Validator
    • ๋ฌธ์ž์—ด์˜ ๊ธธ์ด๋ฅผ ๊ฒ€์‚ฌํ•˜๋Š” Validator

๊ฒฐ๊ณผ

์งˆ๋ฌธ

  • MySQL์ด ์•„๋‹Œ mongoDB๋ฅผ ์„ ํƒํ•œ ์ด์œ  (update๊ฐ€ ๋งŽ๋‹ค๋ฉด mysql์ด ๋‚ซ์ง€ ์•Š์„๊นŒ์š”?)

    • ํ”„๋กœ์ ํŠธ ํ™•์žฅ์„ ๊ณ ๋ คํ–ˆ์„ ๋•Œ, ํ™•์žฅ์„ฑ์ด ์šฉ์ดํ•˜๋‹ค๋Š” ์ 
    • SNS ํŠน์„ฑ์ƒ ๋Œ€์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃจ์–ด์•ผ ํ•œ๋‹ค๋Š” ์ 
    • null system์— ๋Œ€์‘ ๊ฐ€๋Šฅ
    • ๋Œ€์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ(์ง€๋„ ๋ฐ์ดํ„ฐ)์— ์œ ๋ฆฌ
    • Node๋Š” MySQL๊ณผ ์ž˜ ๋งž์ง€ ์•Š๊ณ , MongoDB๊ฐ€ ๋” ์ ํ•ฉํ•˜๋‹ค๋Š” ๋ฉ˜ํ† ๋‹˜์˜ ์กฐ์–ธ
  • mongoDB์˜ ์žฅ์ (embedded, ์ค‘๋ณต)์„ ์‚ด๋ฆฌ๊ธฐ ์œ„ํ•ด ์ €ํฌ๋Š” link ์ตœ์†Œ๋ฅผ ๋ชฉ์ ์œผ๋กœ ๊ฒฐ๊ตญ ์“ฐ์ง€ ์•Š๋Š”๋ฐ, ์—ฌ๋Ÿฌ collection์œผ๋กœ ๋‚˜๋ˆ„๊ณ  link๋ฅผ ์“ฐ์‹  ์ด์œ  (๋ง์”€ํ•ด์ฃผ์…จ์ง€๋งŒ) ๋“ฃ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

    • (web26)embedded๋Š” sync๋ฅผ ๋งž์ถ”๊ธฐ ์œ„ํ•ด ๊ฐœ๋ฐœ์ž cost๊ฐ€ ๋” ๋“ค๊ณ  ํž˜๋“ค์–ด์ง
    • (web26)document๊ฐ€ ๋Š˜์–ด๋‚˜๋Š” ๊ฒƒ์„ ๊ณ ๋ ค
    • (web11)update๊ฐ€ ๋งค์šฐ ์ ๊ฒŒ ์ผ์–ด๋‚˜์„œ sync๊ฐ€ ํž˜๋“ค์ง€๋Š” ์•Š๋‹ค๊ณ  ๊ณ ๋ คํ•จ
    • (web11) embedded ํ•  ์‹œ document ํƒ์ƒ‰์ด ๋„ˆ๋ฌด ์“ธ๋ฐ์—†์ด ํ•˜๋Š” ๊ฒƒ์ด ์žˆ์–ด์„œ collection์œผ๋กœ ๋‚˜๋ˆˆ ๋ถ€๋ถ„๋„ ์žˆ์Œ
  • ์ดˆ์„ฑ ๋‹ค์‹œ ํ•œ ๋ฒˆ๋งŒ ์„ค๋ช…ํ•ด ์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ €ํฌ ํŒ€๋„ ์ ์šฉํ•ด ๋ณด๊ณ  ์‹ถ์–ด์š”!

    • ํ•œ๊ธ€ ํƒœ๊ทธ ์ž๋™์™„์„ฑ์„ ์œ„ํ•ด ์›๋ž˜ ๊ธ€์ž์™€, ์ดˆ์„ฑ, ๋ชจ์Œ ์ž์Œ์„ ๋”ฐ๋กœ ์ €์žฅ

    • ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ regex๋ณด๋‹ค mongodb regex๊ฐ€ ํ›จ์”ฌ ๋น ๋ฅด๋‹ค

    • mongodb regex๋Š” ์ด์–ด์ง„ ๊ฒƒ๋“ค์„ ์ฐพ๊ธฐ ๋•Œ๋ฌธ์— ์ดˆ์„ฑ์ด๋ž‘ ํ’€๋„ค์ž„ ์ž์Œ๋ชจ์Œ์ด๋ž‘ ๋”ฐ๋กœ ์ €์žฅํ•ด์•ผ ํ•œ๋‹ค

  • ์„œ๋ฒ„ ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ ์–ด๋–ป๊ฒŒ ํ•˜์…จ๋‚˜์š”..?

    • (web11)pm2 restart vs reload์˜ ์ฐจ์ด๊ฐ€ ์žˆ๋Š”๋ฐ, reload์˜ ๊ฒฝ์šฐ์—๋Š” process๋ฅผ 1๊ฐœ ์ดˆ๊ณผ๋กœ ์‚ฌ์šฉ ์‹œ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ค‘๋‹จ๋˜์ง€ ์•Š๊ณ  ์ง€์›๋จ(process๊ฐ€ 1๊ฐœ๋ผ๋ฉด ์˜๋ฏธ ์—†์Œ)
  • TDD/test ํ•˜๊ณ  ๊ณ„์‹œ๋‚˜์š”?

    • backend๋Š” TDD์ด์ง€๋งŒ frontend๋Š” TDD ๊ตณ์ด..?
    • test๊ฐ€ ํ•จ์ˆ˜๋‹จ์œ„๋กœ ์ด๋ฃจ์–ด์ง€๋Š”๋ฐ front์—์„œ๋Š” ์ปดํฌ๋„ŒํŠธ ๋‹จ์œ„๋กœ ์ด๋ฃจ์–ด์ง€๋Š”๋ฐ ์ปดํฌ๋„ŒํŠธ ํ…Œ์ŠคํŠธ๋Š” ๋‹จ์ˆœํ•œ UI test์— ๋ถˆ๊ณผํ•˜๋‹ค
    • backend๋Š” ์ƒํƒœ๊ฐ€ ๋˜‘๊ฐ™์ง€๋งŒ frontend๋Š” ์‚ฌ์šฉ์ž์— ๋”ฐ๋ผ ์ƒํƒœ๊ฐ€ ๋‹ฌ๋ผ์ง€๊ธฐ ๋•Œ๋ฌธ์— testํ•˜๊ธฐ ํž˜๋“ค๋‹ค
  • Elastic Search๋Š” ๊ณ ๋ คํ•ด๋ณด์…จ๋Š”์ง€?

    • ๊ฒ€์ƒ‰์€ ํƒœ๊ทธ๋งŒ ๋˜๋Š”๊ฑด๊ฐ€์š”?
  • mysql, mongodb์˜ ์ธ๋ฑ์Šค ๋‹ค๋ฅธ ์  ๋‹ค์‹œํ•œ๋ฒˆ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”ใ…œ

    • ํ™•์‹คํ•˜์ง€ ์•Š์•„์„œ ๋‹ค์‹œ ์ฐพ์•„๋ณด์ž!
    • mysql์€ B+ํŠธ๋ฆฌ, mongodb๋Š” BํŠธ๋ฆฌ+ first, second? ๋” ๊ณต๋ถ€ํ•ด๋ด์•ผํ•œ๋‹ค!!
  • mongoDB ๋ชจ๋ธ๋ง์„ ์–ด๋–ป๊ฒŒํ•˜๊ณ  ๊ณ ๋ฏผํ–ˆ๋Š”์ง€

    • ์ง€์—ญ๋ณ„๋กœ ํ‰์ ๊ณผ ์ง€์—ญ ๋‚ด ๊ตฌ, ๋™์˜ ํ‰์  data๋ฅผ ์–ด๋–ป๊ฒŒ ์„ค๊ณ„ํ•˜์‹œ๊ณ  ๊ด€๋ฆฌํ•˜์ง€๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
      • MapInfo ๋‚ด๋ถ€์— ์‹œ, ๊ตฌ, ๋™ ์„ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๊ณ  ๋ณ‘๋ ฌ์ ์œผ๋กœ ์ž‘์„ฑ(ํ–‰์ •๊ตฌ์—ญ code ๊ฐ’์ด ์ž์ฒด์ ์œผ๋กœ ๋ณ‘๋ ฌ์  ๊ตฌ์กฐ์ž„, ์ฟผ๋ฆฌ๋ฌธ์„ ์งœ๋Š” ๊ฒƒ์ด ๋” ์‰ฌ์›€)
  • ๋ฐฑ์—”๋“œ์™€ ํ”„๋ก ํŠธ์—”๋“œ ์ž‘์—…์ด ํ”ผ์ณ๋‹จ์œ„๋กœ ๋‚˜๋ˆ„์–ด์ ธ์žˆ๋‚˜์š”? ์•„๋‹˜ ๋ฐฑ์—”๋“œ ํ”„๋ก ํŠธ์—”๋“œ๋ฅผ ์–ด๋Š์ •๋„ ๋‚˜๋ˆ ์„œ ํ•˜๊ณ ์žˆ๋‚˜์š”?

    • (web26) ํ”ผ์ฒ˜ ๋‹จ์œ„์—์„œ ๋ฐฑ,ํ”„๋ก ํŠธ ๋‚˜๋ˆ„์–ด์„œ
    • (web11) ์ฟผ๋“œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์—์„œ ๋ฐœ์ƒํ•œ ์ด์Šˆ/ํ”ผ์ฒ˜ ๋‹จ์œ„๋กœ
  • validator๋ถ€๋ถ„๋„ ํ›… ์ง€๋‚˜๊ฐ€์„œ ์ดํ•ด๋ฅผ ์ž˜ ๋ชปํ–ˆ๋„ค์š”ใ…œ

    • ์ดํ•ด์™„๋ฃŒ pass~?
  • ์ง€๋ฆฌ ๋ฐ์ดํ„ฐ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ํ™œ์šฉํ•˜์…จ๋‚˜์š”

    • ํ†ต๊ณ„์ฒญ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ (API)
  • ํฌ๋กค๋ง์ด ์™œ ๋ฐฑ์—”๋“œ์—์„œ ๋˜์•ผํ•˜๋Š”์ง€ ํ•œ๋ฒˆ๋”...

    • ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ buffer๊ฐ€ ๊ฑธ๋ฆฌ๋Š” ์ž‘์—…์€ ์ ˆ๋Œ€ ํ”ผํ•˜์ž! -> ํด๋ผ์ด์–ธํŠธ์—์„œ ํ•˜๋ฉด buffer๋‹ค
    • ํด๋ผ์ด์–ธํŠธ PC ์„ฑ๋Šฅ, ๋„คํŠธ์›Œํฌ ์ƒํƒœ๋ฅผ ๋ฏฟ์œผ๋ฉด ์•ˆ๋œ๋‹ค!
    • ๋”ฐ๋ผ์„œ, ์„œ๋ฒ„์—์„œ ํ•˜๋Š”๊ฒŒ ์ข‹์€๋ฐ... ์„œ๋ฒ„๊ฐ€ ๋˜ ํ„ฐ์งˆ ์ˆ˜ ์žˆ์œผ๋‹ˆ๊นŒ ์–ด๋ ต๋‹ค!
  • ์šฐ๋ฆฌ ํŒ€์˜ ์ž˜ํ•œ ์  ํ•œ ๊ฐ€์ง€์”ฉ ๋งํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

    • (web26) ์„œ๋กœ์— ๋Œ€ํ•œ ํ”ผ๋“œ๋ฐฑ์ด ๊ต‰์žฅํžˆ ๋น ๋ฅด๋‹ค.
    • (web11) ์•„์นจ, ์ €๋…์œผ๋กœ ์Šคํฌ๋Ÿผ/์ค‘๊ฐ„์ ๊ฒ€์„ ํ†ตํ•ด์„œ ์†Œํ†ต์„ ๋งŽ์ด ํ•œ๋‹ค.
  • recoil์— ์–ด๋–ค ๊ฐ’๋“ค์„ ์ €์žฅํ–ˆ๋‚˜์š”?

    • user ๊ฐ์ฒด : followํ•œ ์‚ฌ๋žŒ, follow ๋‹นํ•œ ์‚ฌ๋žŒ, username ๋“ฑ user์— ๊ด€ํ•œ ๋ชจ๋“  ์ •๋ณด
    • NextJS๋กœ server์—์„œ ์ƒ๋‹น ๋ถ€๋ถ„ ์ฒ˜๋ฆฌํ•ด์„œ page ์ปดํฌ๋„ŒํŠธ์˜ props๋กœ ๋„˜๊ฒจ์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์ƒํƒœ๊ด€๋ฆฌ์˜ ํ•„์š”์„ฑ์ด ์ค„์–ด๋“ฆ
  • NextJS๋ฅผ ์„ ํƒํ•˜์‹  ์ด์œ ๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?

    • ์ฐฌ์–‘ํ• ๋งŒํ•ด์„œ(๋Œ€์ฒด ๋ถˆ๊ฐ€ํ•œ SSR Framework, SEO๋ฅผ ์œ„ํ•œ ๊ฒƒ)
    • ํ”„๋กœ์ ํŠธ ๊ตฌ์„ฑ์ด ์•„์ฃผ ํŽธ๋ฆฌํ•˜๋‹ค! -> 9.3 ๋ฒ„์ „๋ถ€ํ„ฐ ์ฐฌ์–‘๋ฐ›์•„ ๋งˆ๋•…ํ•˜๋‹ค!

ํŒ€

๊ฐœ๋ฐœ
๋ฐ๋ชจ
์Šคํฌ๋Ÿผ
์Šคํ”„๋ฆฐํŠธ
ํ”ผ์–ด์„ธ์…˜
ํšŒ๊ณ ๋ก
Clone this wiki locally