Cov txheej txheem:

TypeORM siv rau dab tsi?
TypeORM siv rau dab tsi?

Video: TypeORM siv rau dab tsi?

Video: TypeORM siv rau dab tsi?
Video: 🚀 RUTUBE и ТОЧКА. Разработка РУТУБА за 5 часов *БЕЗ ВОДЫ* [Next / React / Nest / PostgreSQL / Redux] 2024, Kaum ib hlis
Anonim

TypeORM yog ORM uas tuaj yeem khiav hauv NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, thiab Electron platforms thiab tuaj yeem ua tau. siv nrog TypeScript thiab JavaScript (ES5, ES6, ES7, ES8).

Kuj paub, Kuv yuav nruab TypeORM li cas?

Kev teeb tsa

  1. Nruab npm pob: npm nruab typeorm --save.
  2. Koj yuav tsum nruab reflect-metadata shim: npm nruab reflect-metadata --save. thiab import nws qhov chaw hauv ntiaj teb no ntawm koj lub app (piv txwv li hauv app.ts): import "reflect-metadata";
  3. Tej zaum koj yuav xav tau rau nruab node typings: npm nruab @types/node --save.

Qhov thib ob, Sequelize yog dab tsi? Sequelize yog kev cog lus-raws li ORM rau Node. js. Sequelize Nws yog ib qho yooj yim kawm thiab muaj kaum ob ntawm cov yam ntxwv txias xws li synchronization, koom haum, validation, thiab lwm yam. Nws kuj muaj kev txhawb nqa rau PostgreSQL, MySQL, MariaDB, SQLite, thiab MSSQL. Kuv xav tias koj muaj qee hom kev pabcuam SQL database pib ntawm koj lub tshuab.

Ib yam li ntawd, Hom ORM yog dab tsi?

Object-relational mapping ( ORM , O/RM, thiab O/R mapping tool) hauv computer science yog txheej txheem programming los hloov cov ntaub ntawv ntawm qhov tsis sib xws. hom systems siv hom lus-oriented programming. Qhov no tsim, qhov tseeb, ib qho "virtual object database" uas tuaj yeem siv los ntawm cov lus programming.

Kuv yuav siv TypeORM li cas?

Piv txwv li siv TypeORM nrog TypeScript

  1. clone repository.
  2. run npm i.
  3. kho ormconfig.json thiab hloov koj qhov kev teeb tsa database (koj tuaj yeem hloov hom database, tab sis tsis txhob hnov qab txhim kho cov tsav tsheb tshwj xeeb)
  4. run npm pib.
  5. lom zem!

Pom zoo: