-
Book Overview & Buying
-
Table Of Contents
Nest.js: A Progressive Node.js Framework
By :
Probably the best thing about using an ORM is that you can take advantage of the modelling abstraction that they provide: basically, they allow us to think about our data and to shape it with properties (including types and relations), generating “object types” (and plugging them to databases tables) that we can then use and manipulate as direct interfaces.
This abstraction layer saves you from writing database-specific code like queries, joins, etc. A lot of people love not having to struggle with selects and the like; so this abstraction layer comes in handy.
When working with TypeORM, this object abstractions are named entities.
An entity is basically a class that is mapped to a database table.
With that said, let’s create our first entity, which we will name Entry. We will use this entity to store entries (posts) for our blog. We will create a new file at src/entries/entry.entity.ts; that way TypeORM will be able to find...
Change the font size
Change margin width
Change background colour