This project is a RESTful API built with Node.js and MongoDB to manage products, orders, and users for a online store.
To get started with the project, follow these instructions:
- Node.js and npm installed on your machine
- MongoDB installed and running locally or accessible remotely
-
Clone the repository to your local machine:
-
Install dependencies:
-
Configure environment variables:
-
Create a .env file in the root directory of the project and specify the following environment variables:
-
Run the server:
Once the server is running, you can access the API endpoints using tools like Postman. Here are the available endpoints:
- /products: Endpoint to manage products (GET, POST)
- /products/{productId}: Endpoint to get, update, or delete a product by ID (GET, PATCH, DELETE)
- /orders: Endpoint to manage orders (GET, POST)
- /orders/{orderId}: Endpoint to get or delete an order by ID (GET, DELETE)
- /users/signup: Endpoint to register a new user (POST)
- /users/login: Endpoint to authenticate a user and generate a JWT token (POST)
- /users/{userId}: Endpoint to delete a user by ID (DELETE)
- Node.js - JavaScript runtime environment
- Express.js - Web application framework for Node.js
- MongoDB - NoSQL database
- JWT - JSON Web Tokens for user authentication
- Multer - Middleware for handling multipart/form-data (file uploads)