Cov ntsiab cai dav dav rau kev tsim URI zoo:
- Tsis txhob siv cov lus nug tsis hloov pauv lub xeev.
- Tsis txhob siv cov ntaub ntawv sib xyaw. Lowercase yog qhov zoo tshaj.
- Tsis txhob siv cov kev siv tshwj xeeb txuas ntxiv hauv koj li URIs (. …
- Ua kom txoj kab luv luv.
- Ua siv cov lus nug tsis tau rau kev xaiv cov peev txheej; i.e. pagination, search queries.
Dab tsi ua rau tus qauv URI zoo?
URIs yuav tsum ua raws qhov kev kwv yees, cov qauv hierarchical txhawm rau txhim kho kev nkag siabthiab, yog li ntawd, kev siv tau: kwv yees hauv kev txiav txim siab tias lawv nyob ib puag ncig, hierarchical hauv kev nkag siab tias cov ntaub ntawv muaj qauv - kev sib raug zoo. RESTful APIs yog sau rau cov neeg siv khoom. … Tsim rau koj cov neeg siv khoom, tsis yog rau koj cov ntaub ntawv.
URI tsim yog dab tsi?
URI. Ib qho Uniform Resource Identifier (URI) yog ib lub cim tshwj xeeb ntawm cov cim uas txheeb xyuas cov laj thawj lossis lub cev siv los ntawm lub vev xaib thev naus laus zisURIs yuav raug siv los txheeb xyuas txhua yam, suav nrog cov khoom tiag tiag, xws li tib neeg thiab chaw, tswv yim, lossis cov ntaub ntawv xov xwm xws li nplooj ntawv web thiab phau ntawv.
Yuav ua li cas ntawm txoj cai hauv qab no yuav tsum ua raws li tsim qhov URL zoo?
Xaiv ib qho lossis ntau qhov kev xaiv URIs yuav tsum tsis txhob hloov pauvURIs yuav tsum tau tsim los ntawm tus neeg siv khoom URIs yuav tsum luv luv URIs yuav tsum yog case-sensitive HTTP verbs yuav tsum siv hloov. ntawm cov npe ua haujlwm hauv URIs Siv qhov chaw thaum tsim URI Redirection yuav tsum tau siv.
Puas URI yuav tsum tsis txhob hloov?
URIs kuj tseem yuav tsum tau mus tas li (piv txwv li xaiv URI ib zaug thiab tawm ntawm qhov ntawd).… Yuav muaj ib lub sij hawm uas koj xav kom txhim kho koj cov kev xaiv los sis lwm yam yuav tsum tau hloov URI qauv. Thaum qhov no dhau los ua qhov tsim nyog, nco ntsoov teeb tsa HTTP 301 tsiv mus tas li redirects ntawm koj lub server.