Entities

Introduction

Puro REST Framework uses TypeORM for managing database entities.

Defining an entity

import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
import { BeforeInsert } from 'typeorm';

@Entity()
export class Book {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column({ length: 128 })
  title!: string;

  @Column({ length: 256 })
  description!: string;
}

Last updated

Was this helpful?