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.
Creating a model( or Table )
Primary / Auto-generation column
Relationship between two or more models.
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)