This simple CRUD REST application, based on generated NestJS started plate, is a brief demonstration of TypeScript and NestJS skills, coveringv following requirements:
Simple CRUD service exposing REST endpoints to:
- Favourite characters, locations, & episodes.
- Review and rate episodes.
- Include text.
- Star rating (1-5).
- Create open API definition for your schema (OAS3).
- Write unit tests and show coverage report.
$ npm install
# Development.
$ npm run start
# Watch mode.
$ npm run start:dev
# Production mode.
$ npm run start:prod
# Initialize the database with seed data (only needed once).
$ npm run seed
Main REST API Endpoints:
See Swagger UI for details on all endpoints and operations.
For local development purposes, the app is backed by SQLite database in data/database.db
.
To initialize the databse with seed data run npm run seed
.
erDiagram
User {
int id PK
string name UK "NN"
}
Favourite {
int id PK
int userId FK, UK "NN, Unique constraint on (userId, entityId, entityTypeId)"
int entityId "NN"
int entityTypeId FK "NN"
}
EntityType {
int id PK
string type UK "NN"
}
Review {
int id PK
int userId FK "NN, Unique constraint on (userId, episodeId)"
int episodeId "NN"
string text "NN"
int rating "NN"
}
User ||--|{ Favourite : "has"
EntityType ||--|{ Favourite : "categorizes"
User ||--|{ Review : "writes"
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Nest is MIT licensed.