This repository contains a fully-featured API developed using NestJS framework. The API demonstrates common features and best practices when using NestJS for building efficient, reliable and scalable server-side applications.
-
The API provides features to create, read, update, and delete coffee resources, demonstrating how to implement standard CRUD operations in a RESTful API using NestJS. Here are some highlights:
-
Controllers and Providers: Demonstrates the usage of controllers and providers in NestJS, which are fundamental building blocks of a NestJS app.
-
Middleware: Demonstrates how to use middleware for handling the processing of requests and responses.
-
Exception Filters: Implements custom exception handling using filters.
-
Pipes: Uses validation pipes for validating incoming requests.
-
Interceptors: Demonstrates the usage of interceptors to transform the data being returned from route handlers.
-
Guards: Implements guards for handling authorization.
-
Swagger API Documentation: The API is fully documented with Swagger OpenAPI.
-
TypeORM and PostgreSQL: Uses TypeORM for handling database operations and PostgreSQL as the database.
-
Entity Relationships: Demonstrates the usage of TypeORM for managing entity relationships (ManyToMany, OneToMany etc.).
- NestJS
- TypeORM
- PostgreSQL
- Swagger
- Clone the repository
- Install dependencies with npm install
- Start your Postgres database
- Run the API with npm run start
Navigate to http://localhost:3000/api
to view the Swagger API documentation.
DATABASE_USER=Your database user name
DATABASE_PASSWORD=Your database password
DATABASE_NAME=Your database
DATABASE_PORT=Your database port
DATABASE_HOST=Your database host
API_KEY=An API key for secure endpoints.