This project is a Fastify API server built with TypeScript, designed to manage Products and Brands with CRUD operations. It uses MongoDB as the database.
-
Clone the repository:
git clone https://github.com/warutntp/fastify-ts-mongo-api.git cd fastify-ts-mongo-api -
Install dependencies:
npm install
To start the server in development mode:
npm run startThe server will run on http://localhost:3000.
Brands
GET /brands: Get all brands
GET /brands/:id: Get a brand by ID
POST /brands: Create a new brand
PUT /brands/:id: Update a brand by ID
DELETE /brands/:id: Delete a brand by ID
Products
GET /products: Get all products
GET /products/:id: Get a product by ID
POST /products: Create a new product
PUT /products/:id: Update a product by ID
DELETE /products/:id: Delete a product by IDsrc/
├── api
│ ├── brand
│ │ ├── controller.ts
│ │ └── routes.ts
│ └── product
│ ├── controller.ts
│ └── routes.ts
├── models
│ ├── brand.ts
│ └── product.ts
├── database.ts
├── routes.ts
└── server.ts