Skip to content

About

Tutorial: deploy a NestJS API with a database on Light Cloud

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

tutorial-nestjs-api

Deploy to Light Cloud

A small NestJS 12 API with a PostgreSQL connection, used in the Light Cloud tutorial Deploy a NestJS API with a database connection.

flowchart LR
  client[Client] -->|HTTPS| lc[Light Cloud]
  lc -->|PORT| nest[NestJS app]
  nest --> notes[NotesController]
  nest --> health[HealthController]
  notes --> db[(PostgreSQL via DATABASE_URL)]
  health --> db
Loading

Run it

npm install
DATABASE_URL='postgresql://user:password@host:5432/db?sslmode=require&uselibpqcompat=true' npm run start
Route What it does
GET /health checks the database too
GET /notes latest 50 notes
POST /notes {"text": "..."}, validated
GET /notes/:id one note, or 404

About

Tutorial: deploy a NestJS API with a database on Light Cloud

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages