Dab tsi yog kev siv pob JSON hauv node JS?
Dab tsi yog kev siv pob JSON hauv node JS?

Video: Dab tsi yog kev siv pob JSON hauv node JS?

Video: Dab tsi yog kev siv pob JSON hauv node JS?
Video: Nkauj mos ab ib txhia tub sab 7/25/2018 2024, Kaum ib hlis
Anonim

pob . json yog ib qho yooj yim JSON (Java Script Object Notation) cov ntawv nyeem uas muaj tag nrho cov ntaub ntawv metadata txog Node JS Qhov project los yog daim ntawv thov . Txhua Node JS Pob los yog Module yuav tsum muaj cov ntaub ntawv no nyob rau hauv paus directory los piav txog nws cov metadata hauv dawb JSON Hom ntawv hom.

Ib yam li ib tug yuav nug, pob JSON yog dab tsi nws siv rau?

Tag nrho npm tej pob khoom muaj cov ntaub ntawv, feem ntau nyob rau hauv qhov project root, hu ua pob . json - Cov ntaub ntawv no tuav ntau yam metadata cuam tshuam rau qhov project. Cov ntaub ntawv no yog siv muab cov ntaub ntawv rau npm uas tso cai rau nws los txheeb xyuas qhov project thiab tswj qhov project qhov kev vam khom.

Ib yam li ntawd, lub hom phiaj ntawm node JS yog dab tsi? Node. js yog lub platform tsim los ntawm Chrome's JavaScript runtime kom yooj yim tsim kom nrawm thiab scalable network applications. Node. js siv qhov kev tshwm sim-tsav, tsis yog - thaiv I / O tus qauv uas ua rau nws hnyav thiab ua haujlwm tau zoo, zoo meej rau cov ntaub ntawv siv lub sijhawm tiag tiag uas khiav hla cov khoom siv sib faib.

Tom qab ntawd, dab tsi yuav tsum nyob hauv pob JSON?

A pob . json ntaub ntawv yuav tsum muaj "npe" thiab "version" teb. Lub "npe" teb muaj koj pob khoom npe, og yuav tsum ua tus lej qis thiab ib lo lus, thiab tej zaum yuav muaj hyphens thiab underscores. Qhov "version" teb yuav tsum nyob rau hauv daim ntawv x.x.x thiab ua raws li cov txheej txheem semantic versioning.

Lub ntsiab lus nkag hauv pob JSON yog dab tsi?

Cov nkag point yog cov ntaub ntawv, uas nws module. cov khoom xa tawm raug xa rov qab raws li tus nqi xa rov qab ntawm qhov xav tau () -hu. json cov ntaub ntawv thiab xyuas seb nws puas muaj cov khoom tseem ceeb. Nws yuav siv rau taw tes ib cov ntaub ntawv nyob rau hauv lub pob directory uas yuav yog tus nkag point.

Pom zoo: