Puas yog kev sau cov haujlwm uas tsim cov lus teb rau GraphQL cov lus nug?
Puas yog kev sau cov haujlwm uas tsim cov lus teb rau GraphQL cov lus nug?

Video: Puas yog kev sau cov haujlwm uas tsim cov lus teb rau GraphQL cov lus nug?

Video: Puas yog kev sau cov haujlwm uas tsim cov lus teb rau GraphQL cov lus nug?
Video: Leejtwg Yog Tus Tsim (Official Music Video 2023) N. Vajxob, Nxf. Tshuav Num, N. Txoov Kav 2024, Hlis ntuj nqeg
Anonim

Nyob rau hauv thiaj li yuav teb rau lus nug , ib tug schema yuav tsum muaj daws cov haujlwm rau txhua qhov chaw. Qhov no sau cov haujlwm hu ua "resolver map". Daim ntawv qhia no hais txog cov schema teb thiab hom rau a muaj nuj nqi.

Tom qab ntawd, koj sau cov lus nug hauv GraphQL li cas?

A GraphQL lus nug yog siv los nyeem lossis nqa cov txiaj ntsig thaum muaj kev hloov pauv sau los yog post qhov tseem ceeb.

Cia peb tsim ib daim ntawv thov yooj yim kom nkag siab cov lus nug sib txawv.

  1. Kauj ruam 1 - Kho cov ntaub ntawv Schema.
  2. Kauj ruam 2 - Kho kom raug neeg daws teeb meem.
  3. Kauj Ruam 3 - Tshaj Tawm Cov Lus Nug Sib txawv hauv GraphiQL.

Tsis tas li ntawd, GraphQL subscriptions siv rau dab tsi? Kev tso npe yog a GraphQL feature uas tso cai rau lub server xa cov ntaub ntawv rau nws cov neeg siv khoom thaum muaj xwm txheej tshwj xeeb tshwm sim. Kev tso npe feem ntau yog siv nrog WebSockets. Hauv qhov teeb tsa ntawd, tus neeg rau zaub mov tswj kev sib txuas ruaj khov rau nws cov neeg siv khoom.

Hauv qhov no, dab tsi yog qhov kev daws teeb meem?

Kev daws teeb meem txhais. Txhua daim teb ntawm txhua hom yog txhawb nqa los ntawm a muaj nuj nqi npe a daws . A daws yog a muaj nuj nqi uas daws tus nqi rau ib hom lossis teb hauv schema. Cov kev daws teeb meem tuaj yeem xa rov qab cov khoom lossis scalar xws li Strings, Numbers, Booleans, thiab lwm yam.

Kev thauj mus los twg Apollo siv los siv rau kev tso npe?

Qhov nrov tshaj plaws thauj rau GraphQL kev tso npe hnub no yog kev tso npe - thauj -ws. Cov pob no yog tswj xyuas los ntawm cov Apollo zej zog, tab sis yuav ua tau siv nrog txhua tus neeg siv lossis server GraphQL kev siv.

Pom zoo: