GraphQL๊ณผ Apollo ์„ธ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL์˜ ์ •๋ณด ์ฃผ๊ณ  ๋ฐ›๋Š” ๋ฐฉ์‹

2023. 11. 16. 21:09ใ†Back-End ์ž‘์—…์‹ค/๊ธฐํƒ€ ์ฐธ๊ณ  ์ž๋ฃŒ

728x90
๋ฐ˜์‘ํ˜•

 

 

์นด์นด์˜คํŽ˜์ด | ๋งˆ์Œ ๋†“๊ณ  ๊ธˆ์œตํ•˜๋‹ค

์—ฌ๊ธฐ๋ฅผ ๋ˆŒ๋Ÿฌ ๋งํฌ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

qr.kakaopay.com

 

 

 

GraphQL๊ณผ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋กœ ๊ฐœ๋ฐœํ•˜๋Š” ์›น ์„œ๋น„์Šค:์„ค๊ณ„๋ถ€ํ„ฐ ๊ฐœ๋ฐœ·๋ฐฐํฌ๊นŒ์ง€ ๋”ฐ๋ผ ํ•˜๋ฉฐ ์™„์„ฑํ•˜๋Š” ์›น ํ’€

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 




๐Ÿ—‚ ๋ชฉ์ฐจ

โœ… GraphQL๊ณผ Apollo ์ฒซ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - ๊ฐœ๋… ์ตํžˆ๊ธฐ
โœ… GraphQL๊ณผ Apollo ๋‘๋ฒˆ์งธ ์ด์•ผ๊ธฐ - REST API๋ž€?
โœ… GraphQL๊ณผ Apollo ์„ธ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL์˜ ์ •๋ณด ์ฃผ๊ณ  ๋ฐ›๋Š” ๋ฐฉ์‹

โœ… GraphQL๊ณผ Apollo ๋„ค๋ฒˆ์งธ ์ด์•ผ๊ธฐ - Apollo๋ž€?
โœ… GraphQL๊ณผ Apollo ๋‹ค์„ฏ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ตฌํ˜„ํ•ด ๋ณด์•„์š” ๐Ÿ˜€
โœ… GraphQL๊ณผ Apollo ์—ฌ์„ฏ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL Moduleํ™”์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์•„์š” ๐Ÿ˜€
โœ… GraphQL๊ณผ Apollo ์ผ๊ณฑ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL Data Type์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์•„์š” ๐Ÿ˜€
โœ… GraphQL๊ณผ Apollo ์—ฌ๋Ÿ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - GraphQL Union๊ณผ Interface ๊ทธ๋ฆฌ๊ณ  ์ธ์ž์™€ ์ธํ’‹ ํƒ€์ž…์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์•„์š” ๐Ÿ˜€
โœ… GraphQL๊ณผ Apollo ์•„ํ™‰๋ฒˆ์งธ ์ด์•ผ๊ธฐ - Java + Spring Boot์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ™˜๊ฒฝ ๊ตฌ์„ฑ
โœ… GraphQL๊ณผ Apollo ์—ด๋ฒˆ์งธ ์ด์•ผ๊ธฐ - Java + Spring Boot์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ•ด๋ณด๊ธฐ
โœ… GraphQL๊ณผ Apollo ์—ด ํ•œ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - TypeScript + Nest.js์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ™˜๊ฒฝ ๊ตฌ์„ฑ
โœ… 
GraphQL๊ณผ Apollo ์—ด ๋‘๋ฒˆ์งธ ์ด์•ผ๊ธฐ - TypeScript + Nest.js์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ™˜๊ฒฝ ํ…Œ์ŠคํŠธ
โœ… GraphQL๊ณผ Apollo ์—ด ์„ธ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - TypeScript + Nest์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ•ด๋ณด๊ธฐ
โœ… 
GraphQL๊ณผ Apollo ์—ด ๋„ค๋ฒˆ์งธ ์ด์•ผ๊ธฐ - React์™€ Apollo Client
โœ… GraphQL๊ณผ Apollo ์—ด๋‹ค์„ฏ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - React์™€ Apollo Client - Query์™€ Mutation ์‚ฌ์šฉํ•˜์—ฌ ์›น ํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ
โœ… GraphQL๊ณผ Apollo ์—ด ์—ฌ์„ฏ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - Kotlin + Spring Boot์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ™˜๊ฒฝ ๊ตฌ์„ฑ
โœ… GraphQL๊ณผ Apollo ์—ด ์ผ๊ณฑ๋ฒˆ์งธ ์ด์•ผ๊ธฐ - Kotlin + Spring Boot์—์„œ GraphQL ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ - ์‹ค์Šต ํ•ด๋ณด๊ธฐ


๐Ÿค” ๋‚ด๊ฐ€ ๋งŒ๋‚œ ๋ฌธ์ œ

โš ๏ธ [Nest.js] TypeORM Table ๊ด€๊ณ„๊ฐ€ ๋งบ์–ด์กŒ์„ ๋•Œ, Seeding (feat. Migration)
โš ๏ธ [Spring Boot 3.0] Could not resolve org.springframework.boot:spring-boot-gradle-plugin
โš ๏ธ [Spring Boot 3] Spring Doc(Swagger) White Label Error


๐Ÿ“‹ ๋ถ€๋ก

๐Ÿ” [Nest.js] ์ดˆ๊ธฐ ํ™˜๊ฒฝ ๊ตฌ์„ฑ (feat. TypeORM, QueryBuilder, GraphQL, Apollo)
๐Ÿ” [SOLID][Nest.js][Java + Spring] Interface๋ฅผ ํ™œ์šฉํ•œ ๊ฒฐํ•ฉ๋„ ๋ถ„๋ฆฌ (Interface๋ฅผ ์ด์šฉํ•œ Dependency Injection - DI)

 

 

 

 

๐Ÿš€ GraphQL์˜ ์ •๋ณด ์ฃผ๊ณ  ๋ฐ›๋Š” ๋ฐฉ์‹

    ๐Ÿ”ฝ GraphQL

        ๐Ÿ“ฆ ์ •๋ณด ๋ฐ›๋Š” ๋ฐฉ์‹

์ด๋ฒˆ์—๋Š” GraphQL์„ ์ง์ ‘ ์‚ฌ์šฉํ•ด์„œ ์ •๋ณด๋ฅผ ์ฃผ๊ณ  ๋ฐ›๋Š” ๋ฐฉ์‹์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ• ๊ฒŒ์š”.

GraphQL์€ REST API์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ  ๋ฐ›๋Š” ํ•˜๋‚˜์˜ ํ˜•์‹์ด๊ณ , ๋ฐฉ์‹์ด์—์š”.

apollo playgroud


Backend ์ฝ”๋“œ์— apllo๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฒŒ ๋˜๋ฉด ์œ„์™€ ๊ฐ™์ด Playground๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์ด๊ฑด REST API์—์„œ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” Postman์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ต๋‹ˆ๋‹ค.



REST API์˜ GET Method๋Š” ์„œ๋ฒ„์— ์ •๋ณด๋ฅผ ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•˜๋Š” ๊ฒƒ์ด์—์š”.
GraphQL์€ query๋ผ๋Š” ์งˆ์˜์–ด๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•  ์ˆ˜ ์žˆ์–ด์š”.

์œ„ ๋‚ด์šฉ์€ ์„œ๋ฒ„์— ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•˜๋Š”๋ฐ, teams ์ฆ‰, ํŒ€ ์ •๋ณด๋ฅผ ๋ชจ๋‘ ์–ป๊ณ  ์‹ถ๋‹ค๊ณ  ํ•˜๊ณ , ํ•„์š”ํ•œ ์ •๋ณด๋Š” id, manager, office ๋“ฑ๋“ฑ์˜ ์ •๋ณด๊ฐ€ ํ•„์š”ํ•˜๋‹ค๊ณ  ์„œ๋ฒ„์— ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๋ถ€๋ถ„์ด์—์š”.

๊ทธ๋žฌ๋”๋‹ˆ ๊ฒฐ๊ณผ๊ฐ€ ์˜ค๋ฅธ์ชฝ๊ณผ ๊ฐ™์ด ์ „๋‹ฌ๋˜๋Š” ๊ฑธ ๋ณผ ์ˆ˜ ์žˆ์–ด์š”.


๊ทธ๋ ‡๋‹ค๋ฉด REST API์˜ Overfetching ๋ฌธ์ œ๋ฅผ GraphQL์€ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ–ˆ๋Š”์ง€ ์šฐ๋ฆฌ ๋ˆˆ์œผ๋กœ ํ™•์ธํ•ด ๋ณด์•„์•ผ๊ฒ ์ฃ ?

์ „์ œ ์ƒํ™ฉ์€ ํ˜„์žฌ ํด๋ผ์ด์–ธํŠธ๋Š” ๊ด€๋ฆฌ์ž ์‚ฌ๋ฌด์‹ค ์ •๋ณด๋งŒ ํ•„์š”ํ•œ ์ƒํ™ฉ์ด์—์š”.



์œ„์™€ ๊ฐ™์ด ์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ ํ•„์š”ํ•œ ์ •๋ณด๋งŒ ๋”ฑ! ์š”์ฒญ์„ ํ•˜๋ฉด ์„œ๋ฒ„๋Š” ๊ทธ ์ •๋ณด๋งŒ ๋”ฑ! ๋ณด๋‚ด์ฃผ๊ฒŒ ๋˜๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.
์ด๋ ‡๊ฒŒ Overfetching ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ๋„ค์š”!

 

728x90

 

์ด๋ฒˆ์—๋Š” ํŒ€์˜ ์•„์ด๋””๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ํŠน์ • ํŒ€๋งŒ ํ•œ๋ฒˆ ๋ฐ›์•„์™€ ๋ณผ๊ฒŒ์š”.
REST API๋กœ ์ด๋Ÿฐ ์ •๋ณด๋ฅผ ๋ฐ›์•„์™€์•ผ ํ•œ๋‹ค๋ฉด URI์˜ ํ•ด๋‹น ํŒ€ Index ๋ฒˆํ˜ธ๋ฅผ ๋„ฃ์–ด GET ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด ๋ผ์š”.


์œ„์™€ ๊ฐ™์ด ํ•ญ๋ชฉ ์ด๋ฆ„์„ team์œผ๋กœ ๋ฐ”๊พธ๊ณ , id๋ฅผ ์ง€์ •ํ•ด์„œ ์š”์ฒญ์„ ๋ณด๋‚ด๋ณด์•˜์–ด์š”.

์ฆ‰ ์œ„ ์งˆ์˜๋ฌธ์„ ํ•ด์„ํ•ด ๋ณด๋ฉด index ๋ฒˆํ˜ธ๊ฐ€ 2์ธ ํŒ€ ์ •๋ณด๋ฅผ ๋ฐ›๊ณ  ์‹ถ์€๋ฐ, ํ•ด๋‹น ์ •๋ณด๋Š” ๊ด€๋ฆฌ์ž ์ •๋ณด์™€ ์‚ฌ๋ฌด์‹ค ์ •๋ณด๋งŒ ๋ฐ›๊ณ  ์‹ถ์–ด! ์—์š”.

์ด ๋•Œ, REST API์˜ Underfetching ๋ฌธ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐ ํ–ˆ๋Š”์ง€ ํ™•์ธํ•ด ๋ณด๊ณ  ์‹ถ์–ด์š”.
๋งŒ์•ฝ ํ•ด๋‹น ํŒ€ ์ •๋ณด์™€ ๊ทธ ํŒ€์˜ ์†Œ์†๋œ ํŒ€์›๋“ค์˜ ์ •๋ณด๋ฅผ ๋ฐ›๊ณ  ์‹ถ์„ ๋•Œ, REST API๋Š” ๋‘ ๋ฒˆ ์š”์ฒญ์„ ๋‚ ๋ ค์•ผ ํ•œ๋‹ค๋Š” ํ•œ๊ณ„๋ฅผ ๊ฐ–๊ณ  ์žˆ๋Š” ๊ฑธ ํ™•์ธ ํ–ˆ์—ˆ์–ด์š”.

๊ทธ๋ ‡๋‹ค๋ฉด GraphQL์„ ์ด์šฉํ•œ๋‹ค๋ฉด ์–ด๋–ป๊ฒŒ ์ด๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”?


์œ„์˜ ์งˆ์˜๋ฌธ์„ ๋ณด๋ฉด Index ๋ฒˆํ˜ธ๊ฐ€ 2๋ฒˆ์ธ ํŒ€์˜ id, manager,extension_number,mascot ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ , ํ•ด๋‹น ํŒ€์˜ ์†Œ์†๋œ ํŒ€์› (members) ์ •๋ณด๋ฅผ ๊ฐ–๊ณ  ์˜ค๋Š”๋ฐ, ํŒ€์› ์ •๋ณด์—๋Š” first_name๊ณผ last_name์„ ์ „๋‹ฌ ๋ฐ›๊ณ  ์‹ถ์–ด! ๋ผ๊ณ  ์š”์ฒญ์„ ํ•˜๋Š” ๊ฑฐ๊ณ , ์„œ๋ฒ„๋Š” ํ•œ๋ฒˆ์˜ ์š”์ฒญ์œผ๋กœ ์›ํ•˜๋Š” ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•ด ์ฃผ๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


 

{
  "data": {
    "teams": [
      {
        "id": "1",
        "manager": "Mandy Warren",
        "office": "101A",
        "extension_number": "#5709",
        "mascot": "Panda",
        "members": [
          {
            "first_name": "Nathan",
            "last_name": "Jenkins"
          },
          {
            "first_name": "Isabella",
            "last_name": "Martin"
          },
          {
            "first_name": "Kate",
            "last_name": "Owen"
          },
          {
            "first_name": "Byron",
            "last_name": "Barnes"
          },
          {
            "first_name": "Brian",
            "last_name": "Hunt"
          },
          {
            "first_name": "Violet",
            "last_name": "Pearson"
          },
          {
            "first_name": "Sally",
            "last_name": "Fox"
          },
          {
            "first_name": "Russ",
            "last_name": "Lawrence"
          },
          {
            "first_name": "Leroy",
            "last_name": "Elliott"
          },
          {
            "first_name": "Ned",
            "last_name": "Butler"
          }
        ]
      },
      {
        "id": "2",
        "manager": "Stewart Grant",
        "office": "101B",
        "extension_number": "#4012",
        "mascot": "Tadpole",
        "members": [
          {
            "first_name": "Alex",
            "last_name": "Davidson"
          },
          {
            "first_name": "Page",
            "last_name": "Adams"
          },
          {
            "first_name": "Dennis",
            "last_name": "Marshall"
          },
          {
            "first_name": "Eleanor",
            "last_name": "Smith"
          },
          {
            "first_name": "Zelda",
            "last_name": "Hall"
          },
          {
            "first_name": "Brooke",
            "last_name": "Evans"
          },
          {
            "first_name": "Victoria",
            "last_name": "Brown"
          },
          {
            "first_name": "Nancy",
            "last_name": "Brooks"
          },
          {
            "first_name": "Oliver",
            "last_name": "Simpson"
          },
          {
            "first_name": "Simon",
            "last_name": "Henderson"
          }
        ]
      },
      {
        "id": "3",
        "manager": "Smantha Wheatly",
        "office": "102A",
        "extension_number": "#3852",
        "mascot": "Falcon",
        "members": [
          {
            "first_name": "Lindsay",
            "last_name": "West"
          },
          {
            "first_name": "Noelle",
            "last_name": "Holmes"
          },
          {
            "first_name": "Shirley",
            "last_name": "Grant"
          },
          {
            "first_name": "Toby",
            "last_name": "Lewis"
          },
          {
            "first_name": "Jamie",
            "last_name": "Reynolds"
          },
          {
            "first_name": "Raymond",
            "last_name": "Cook"
          },
          {
            "first_name": "Russel",
            "last_name": "Jones"
          },
          {
            "first_name": "Grant",
            "last_name": "Cole"
          },
          {
            "first_name": "Amber",
            "last_name": "Russel"
          },
          {
            "first_name": "Pansy",
            "last_name": "Moore"
          }
        ]
      },
      {
        "id": "4",
        "manager": "Francis Buckley",
        "office": "103B",
        "extension_number": "#1039",
        "mascot": "Beaver",
        "members": [
          {
            "first_name": "Christine",
            "last_name": "Harris"
          },
          {
            "first_name": "Alfred",
            "last_name": "Clarke"
          },
          {
            "first_name": "Priscilla",
            "last_name": "Walker"
          },
          {
            "first_name": "Barbara",
            "last_name": "White"
          },
          {
            "first_name": "Arnold",
            "last_name": "Armstrong"
          },
          {
            "first_name": "Myrtle",
            "last_name": "Hamilton"
          },
          {
            "first_name": "Edgar",
            "last_name": "Willson"
          },
          {
            "first_name": "Naomi",
            "last_name": "Taylor"
          },
          {
            "first_name": "Chloe",
            "last_name": "Bailey"
          },
          {
            "first_name": "Peter",
            "last_name": "Payne"
          }
        ]
      },
      {
        "id": "5",
        "manager": "Blake Smith",
        "office": "104A",
        "extension_number": "#7750",
        "mascot": "Wildcat",
        "members": [
          {
            "first_name": "Herbert",
            "last_name": "Ford"
          },
          {
            "first_name": "Tyler",
            "last_name": "Philips"
          },
          {
            "first_name": "Nina",
            "last_name": "Dawson"
          },
          {
            "first_name": "Katherine",
            "last_name": "Bennett"
          },
          {
            "first_name": "Margaret",
            "last_name": "Davies"
          },
          {
            "first_name": "Garth",
            "last_name": "Roberts"
          },
          {
            "first_name": "Will",
            "last_name": "McDonald"
          },
          {
            "first_name": "Audrey",
            "last_name": "Fisher"
          },
          {
            "first_name": "Margot",
            "last_name": "Watson"
          },
          {
            "first_name": "Barbara",
            "last_name": "Murphy"
          }
        ]
      }
    ]
  }
}


์œ„์™€ ๊ฐ™์ด ํŠน์ • ํŒ€์ด ์•„๋‹Œ ์ „์ฒด ํŒ€ ์ •๋ณด์—์„œ ์†Œ์†๋œ ํŒ€์›๋“ค์˜ ์ •๋ณด๋ฅผ ์š”์ฒญํ•˜๋ฉด ์š”์ฒญ ํ•œ๋ฒˆ์œผ๋กœ ๋‘ ์ •๋ณด๋ฅผ ์ ์ ˆํ•˜๊ฒŒ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

 

 

 

        ๐Ÿ“ฆ ์ •๋ณด ์ฃผ๋Š” ๋ฐฉ์‹

REST API์—์„œ ์„œ๋ฒ„์— ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•  ๋•Œ POST Method๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋Š” ๊ฒƒ์„ ์ด ์ „ ๊ธ€์—์„œ ๊ณต๋ถ€ํ•ด ๋ณด์•˜์–ด์š”.
๊ทธ๋ ‡๋‹ค๋ฉด GraphQL์€ ์–ด๋–ป๊ฒŒ ์ •๋ณด๋ฅผ ์„œ๋ฒ„์— ์ „๋‹ฌํ•˜์—ฌ ์ž…๋ ฅ ์‹œํ‚ฌ ์ˆ˜ ์žˆ์„๊นŒ์š”?


ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์— ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•  ๋• query๋ผ๋Š” ์งˆ์˜์–ด๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๊ณ  ํ–ˆ๋Š”๋ฐ, ์„œ๋ฒ„์— ๋ฐ์ดํ„ฐ ์ €์žฅ์„ ์œ„ํ•œ ์š”์ฒญ์„ ๋ณด๋‚ด๊ฑฐ๋‚˜, ์ˆ˜์ •, ์‚ญ์ œ ์š”์ฒญ์„ ๋ณด๋‚ผ ๋•Œ๋Š” mutaion ์ด๋ผ๋Š” ์งˆ์˜์–ด๋ฅผ ์‚ฌ์šฉํ•ด ์ฃผ๋ฉด ๋ผ์š”.


 

 

    ๐Ÿ”ฝ ์ •๋ฆฌ

        ๐Ÿ“ฆ ์ •๋ฆฌํ•ด๋ณผ๊ฒŒ์š”!

GraphQL์„ ์‚ฌ์šฉํ•˜๋ฉด REST API์˜ Overfetching, Underfetching ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์—ฌ ํ•„์š”ํ•œ ์ •๋ณด๋“ค๋งŒ ์„ ํƒํ•˜์—ฌ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ๊ณ , ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ๋”ฑ! ํ•œ ๋ฒˆ์˜ ์š”์ฒญ์œผ๋กœ ๊น”๋”ํ•˜๊ฒŒ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ์–ด์š”. ์ด๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ ์ „์†ก๋Ÿ‰์ด ๊ฐ์†Œํ•˜๊ฒŒ ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์„œ๋ฒ„ ์ž์›์ด๋‚˜, ๋„คํŠธ์›Œํฌ ์ž์› ์ธก๋ฉด์—์„œ ๋ถˆ ํ•„์š”ํ•œ ์ž์› ๋‚ญ๋น„๋ฅผ ๋ง‰์„ ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์–ด์š”.

ํ•˜๋‚˜ ์ฐธ๊ณ ํ•  ์‚ฌํ•ญ์€ REST API๋ฅผ ์‚ฌ์šฉํ•ด๋„ ์œ„์˜ ๋‚ด์šฉ์„ ๊ธฐ์ˆ ์ ์œผ๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์—†๋Š” ๊ฒƒ์€ ์•„๋‹Œ ๊ฒƒ์ด์—์š”.
๋‹ค๋งŒ, REST API๋Š” Framework ์ฒ˜๋Ÿผ ๋‹จ๋‹จํ•œ ๊ทœ์น™์ด ์žˆ๊ณ , ๊ทธ๊ฑธ ์ง€์ผœ์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ์˜ ์†Œํ†ต์„ ์„ค๊ณ„ํ•˜๋Š” ๋ฐ ์žˆ์–ด์„œ ์ œ์•ฝ์„ ๊ฒช์„ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด์—์š”.

GraphQL์€ ์ด์™€๋Š” ๋‹ค๋ฅธ ํ˜•์‹์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด ๋ณด๋‹ค ์ž์œ ๋กญ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์–ด์š”.

๊ทธ๋ฆฌ๊ณ , GraphQL์€ ํ•˜๋‚˜์˜ Endpoint์—์„œ ๋ชจ๋“  ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์–ด์š”. ์ฆ‰, ํ•˜๋‚˜์˜ URI์—์„œ POST๋กœ ๋ชจ๋“  ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด REST API์—์„œ๋Š” ์–ด๋–ค ์š”์ฒญ์ธ์ง€๋ฅผ ์•Œ๋ ค์ฃผ๊ธฐ ์œ„ํ•ด ์š”์ฒญ๋งˆ๋‹ค URI๋ฅผ ๋‹ฌ๋ฆฌํ•˜๊ณ , Http Method(GET, POST, PUT/PATCH, DELETE) ๋ฅผ ์„ ํƒํ•˜์—ฌ ์š”์ฒญํ•ด ์ฃผ์–ด์•ผ ํ•˜๋Š”๋ฐ, GraphQL์€ ์ „๋ถ€ Post๋กœ ์š”์ฒญ์„ ๋ณด๋‚ด๊ฒŒ ๋˜๊ณ , ์งˆ์˜์–ด๋ฅผ ํ†ตํ•ด ๋‚ด๊ฐ€ ์–ด๋–ค ์ข…๋ฅ˜์˜ ์ •๋ณด๋ฅผ ์š”์ฒญํ•˜๋Š”์ง€ ์„œ๋ฒ„์— ์•Œ๋ ค์ฃผ๊ฒŒ ํ•ด ์ฃผ๋Š” ๋ฐฉ์‹์ด์—์š”.

๋˜ ํ•˜๋‚˜ ํ˜„์—…์—์„œ ์ผํ•˜์‹œ๋Š” ๋ถ„๋“ค์ด๋ผ๋ฉด ์ ‘ํ•ด ๋ณด์•˜์„ ๋ฌธ์ œ๊ฐ€ ํ•˜๋‚˜ ์žˆ์–ด์š”.

ํ˜น์‹œ KISA์—์„œ ๋ฐœํ–‰ํ•˜๋Š” ์ฃผ์š”์ •๋ณดํ†ต์‹ ๊ธฐ๋ฐ˜์‹œ์„ค ๊ธฐ์ˆ ์  ์ทจ์•ฝ์  ๋ถ„์„ ํ‰๊ฐ€ ์ƒ์„ธ ๊ฐ€์ด๋“œ๋ฅผ ๋“ค์–ด ๋ณด์…จ๋‚˜์š”?
ISMS ์ธ์ฆ์„ ๋ฐ›์œผ๋ ค๊ณ  ์ค€๋น„ํ•˜๋ ค๋Š” ํšŒ์‚ฌ๋‚˜, ๋ฐ›์€ ํšŒ์‚ฌ์— ๊ฐœ๋ฐœ์ž ๋ถ„๋“ค์€ ํ•œ๋ฒˆ์”ฉ ๊ฒฝํ—˜ํ•ด ๋ณด์•˜์„ ๋ฌธ์ œ๋ฅผ ์ด์•ผ๊ธฐ ํ•˜๊ณ  ์‹ถ์–ด์š”.

์ถœ์ฒ˜: https://www.gne.go.kr/upload_data/board_data/notice010/149921923252956.pdf

 

์ถœ์ฒ˜: https://www.gne.go.kr/upload_data/board_data/notice010/149921923252956.pdf


๋ฐ”๋กœ ์ด ๋‚ด์šฉ์ด์—์š”.

๋‚ด์šฉ์„ ๋ณด๋ฉด HTTP Method์—์„œ GET, POST ์™ธ์—๋Š” ๋˜๋„๋ก ๋‹ค๋ฅธ Method๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง๋ผ๋Š” ์ง€์นจ์ด์—์š”.
์‚ฌ์‹ค ์ด ๋ถ€๋ถ„์€ REST API์˜ ๊ทœ์น™์— ์–ด๊ธ‹ํ•˜๋Š” ๋‚ด์šฉ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ต‰์žฅํžˆ ๊ณ ๋ฏผ์ด ๋งŽ์ด ๋˜๋Š” ๋ถ€๋ถ„์ด๊ณ , Nginx ๋“ฑ์„ ํ†ตํ•ด ์•ž ๋‹จ์—์„œ ์ด๋ฅผ ์ฒ˜๋ฆฌํ•ด ์ค„ ์ˆ˜ ์žˆ์ง€๋งŒ, ์–ด์จ‹๋“  ํ•œ ๋‹จ๊ณ„ ๋” ์–ด๋–ค ์ž‘์—…์„ ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๋ฒˆ๊ฑฐ๋กœ์›€์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์š”.

ํŠนํžˆ ISMS ์ธ์ฆ ์‹ฌ์‚ฌ ๋•Œ ์ด ๋ถ€๋ถ„์€ ์กฐ์น˜ ์‚ฌํ•ญ์œผ๋กœ ๊ฑธ๋ฆฌ๊ฒŒ ๋  ๊ฑฐ์—์š”.

๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— GraphQL์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด POST Method๋งŒ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฏ€๋กœ ์ด ๋ฌธ์ œ์—์„œ๋„ ๊ต‰์žฅํžˆ ์œ ์—ฐํ•˜๊ฒŒ ๋Œ€์ฒ˜ํ•  ์ˆ˜ ์žˆ๊ฒ ๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ์–ด์š”.

์ด ๋ถ€๋ถ„์€ ์ฃผ๋‹ˆ์˜ ๊ฒฝํ—˜์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ์ƒ๊ฐ์ž„์„ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”.

 

๋ฐ˜์‘ํ˜•

 

 

 

GraphQL๊ณผ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋กœ ๊ฐœ๋ฐœํ•˜๋Š” ์›น ์„œ๋น„์Šค:์„ค๊ณ„๋ถ€ํ„ฐ ๊ฐœ๋ฐœ·๋ฐฐํฌ๊นŒ์ง€ ๋”ฐ๋ผ ํ•˜๋ฉฐ ์™„์„ฑํ•˜๋Š” ์›น ํ’€

COUPANG

www.coupang.com

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."

 

 

 

๐Ÿง ์ฐธ๊ณ  ์ž๋ฃŒ

ํ•ด๋‹น ๋‚ด์šฉ์€ ์•„๋ž˜ ๊ฐ•์˜๋ฅผ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž„์„ ์•Œ๋ ค ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

 

[๋ฌด๋ฃŒ] ์–„ํŒํ•œ GraphQL๊ณผ Apollo - ์ธํ”„๋Ÿฐ | ๊ฐ•์˜

โšก ์งง๊ณ  ๊ตต์€ ์ „์ฒด 90๋ถ„ ๊ฐ•์ขŒ! ์‚ฌ์ดํŠธ์˜ ์ฝ”๋“œ๋“ค์„ ๋ณต๋ถ™ํ•˜๋ฉฐ ๋น ๋ฅด๊ฒŒ GraphQL์„ ๋ฐฐ์šฐ๊ณ  ์•„ํด๋กœ ์‚ฌ์šฉ๋ฒ•์„ ์ตํžˆ์„ธ์š”., โฑ ์—ฌ๋Ÿฌ๋ถ„์˜ ์‹œ๊ฐ„์€ ์†Œ์ค‘ํ•ฉ๋‹ˆ๋‹ค. [์‚ฌ์ง„] ๐ŸŽข  GraphQL์ด ๋ญ”๊ฐ€์š”? ์„œ๋น„์Šค๋ฅผ ๊ตฌ์„ฑํ•˜๋Š”

www.inflearn.com

 

https://www.gne.go.kr/upload_data/board_data/notice010/149921923252956.pdf

 

 

 

 

์นด์นด์˜คํŽ˜์ด | ๋งˆ์Œ ๋†“๊ณ  ๊ธˆ์œตํ•˜๋‹ค

์—ฌ๊ธฐ๋ฅผ ๋ˆŒ๋Ÿฌ ๋งํฌ๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

qr.kakaopay.com

 

 

 

728x90
๋ฐ˜์‘ํ˜•