DEV Community

Johnathon roy
Johnathon roy

Posted on

TypeORM With NEST JS Basic Tutorial

TypeORM with Nest Js to integrate the database with our application. But before starting with TypeORM, let us have a brief look over the concept of Object-relational mapping(ORM).

Wikipedia defines Object-relational mapping as a technique for converting data between incompatible type systems using object-oriented programming languages. In other words, ORM is a programming technique in which a metadata descriptor is used to connect object code to a relational database. Object code is written in object-oriented programming (OOP) languages such as C++, JAVA, etc. we will be using TypeScript for creations of our object-oriented programming.

In addition to the data access technique, ORM also provide
simplified development because it automates object-to-table and table-to-object conversion, resulting in lower development and maintenance costs.

Now, when we have a good idea about what is the notion of ORM is, let us understand what TypeORM is.

TypeORM: TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used with TypeScript and JavaScript (ES5, ES6, ES7, ES8).


Creating a model( or Table )
Primary / Auto-generation column
Relationship between two or more models.
Our Project
Creating a model/ Table

The first step in the database is to create a table. With TypeORM, we create database tables through models. So models in our app will be our database tables.

You can see Complete code

Top comments (0)