Cov txheej txheem:

Koj teeb tsa GraphQL server li cas?
Koj teeb tsa GraphQL server li cas?

Video: Koj teeb tsa GraphQL server li cas?

Video: Koj teeb tsa GraphQL server li cas?
Video: Vis Hawj_Nkauj Tawm Tshiab 2023-2024: Thov Txim Qhov Tsis Yuav Koj ๐Ÿ˜ข๐Ÿ’” [Full Official MV] 2024, Kaum ib hlis
Anonim

Yuav Ua Li Cas Tsim GraphQL server nrog Nodejs

  1. Kauj Ruam 1 - Txheeb xyuas Node thiab Npm Versions.
  2. Kauj ruam 2 - Tsim ib qhov project Folder thiab qhib hauv VSCode.
  3. Kauj Ruam 3 - Tsim pob.
  4. Kauj ruam 4 - Tsim cov ntaub ntawv tiaj tus Database hauv Cov Ntaub Ntawv Folder.
  5. Kauj ruam 5 - Tsim cov ntaub ntawv nkag txheej.
  6. Kauj ruam 6 - Tsim cov ntaub ntawv Schema, schema. ua graphql .

Cov lus nug tseem yog, GraphQL puas xav tau Server?

GraphQL yog cov lus nug rau APIs thiab lub sijhawm ua haujlwm kom ua tiav cov lus nug nrog koj cov ntaub ntawv uas twb muaj lawm. Cov neeg thov (query) cov ntaub ntawv los ntawm cov server , los yog thov cov server hloov cov ntaub ntawv (mutation). Yog tias koj ua haujlwm ntawm tus neeg siv khoom nkaus xwb, koj tsis ua xav tau lub server (muab nws twb muaj lawm).

Qhov thib ob, Apollo server ua haujlwm li cas? Apollo Server yog lub zej zog-tso tseg qhib-qhov GraphQL server . js HTTP server lub moj khaum, thiab peb zoo siab coj PRs los ntxiv ntau ntxiv! Apollo Server ua haujlwm nrog ib qho GraphQL schema ua nrog GraphQL. js--yog li koj tuaj yeem tsim koj lub tswv yim nrog qhov ntawd lossis lub tsev qiv ntawv yooj yim xws li graphql-tools.

Tom qab ntawd, ib tus tuaj yeem nug, Kuv yuav pib li cas nrog GraphQL?

To-do lis

  1. Xaiv lub moj khaum los siv koj lub GraphQL server. Peb yuav siv Express.
  2. Txhais schema yog li GraphQL paub yuav ua li cas rau cov lus nug tuaj.
  3. Tsim cov kev daws teeb meem uas daws cov lus nug thiab qhia GraphQL dab tsi rov qab los.
  4. Tsim qhov kawg.
  5. Sau cov lus nug ntawm tus neeg siv khoom uas khaws cov ntaub ntawv.

GraphQL puas ua haujlwm nrog SQL?

GraphQL API rau SQL ntawv Database hauv. Qhov tseem ceeb, GraphQL lees txais cov lus nug - uas yog hom JSON-formatted cov ntaub ntawv - thiab sim parse nws mus rau lub schema yav dhau los. Koj tuaj yeem tshaj tawm ob hom lus nug: Lus nug - kom tau txais ntau cov ntaub ntawv thiab tsuas yog cov teb uas tau txhais hauv cov lus nug.

Pom zoo: