Entities and Repositories — Techniques · NestJS

Move the cats into a database: connect with TypeOrmModule, turn the Cat class into an entity, register it so a repository can be injected, and write the service against find, save, delete and the query builder.

What you will learn

Read the theory for Entities and Repositories

All Techniques lessons

All NestJS courses

loading types…

What you'll learn

  • Connect an application with TypeOrmModule.forRoot() and explain synchronize and autoLoadEntities
  • Define an entity with @Entity, @PrimaryGeneratedColumn and @Column, and register it with forFeature so its repository is injectable
  • Use a repository's find, findOneBy, save and delete, decide where a 404 comes from, and write an aggregate with the query builder