This is a simple Node.js server application that provides CRUD (Create, Read, Update, Delete) operations for managing products and clients in a MongoDB database.
- Getting Started
- Prerequisites
- Installation
- Project Structure
- Usage
- Starting the Server
- API Endpoints
- Technologies Used
- Contributing
- License
Before you begin, ensure you have the following installed on your machine:
- Node.js: https://nodejs.org/
- MongoDB: https://www.mongodb.com/try/download/community (Make sure MongoDB is running)
-
Clone this repository to your local machine:
-
Install project dependencies:
The project is organized into the following directories:
controllers
: Contains controller functions for CRUD operations.models
: Defines Mongoose models for products and clients.routes
: Defines Express routes for handling API requests.index.js
: Sets up the Express application and connects to MongoDB.
To start the server, run the following command in your project directory:
The server will be running on port 3000 by default.
-
Products
- Create a new product:
POST /product
- Get all products:
GET /product/get
- Get a single product by ID:
GET /product/:id
- Update a product by ID:
PUT /product/update/:id
- Delete a product by ID:
DELETE /product/:id
- Create a new product:
-
Clients
- Create a new client:
POST /client
- Get all clients:
GET /client/get
- Get a single client by ID:
GET /client/:id
- Update a client by ID:
PUT /client/update/:id
- Delete a client by ID:
DELETE /client/:id
- Create a new client:
- Node.js
- Express.js
- MongoDB
- Mongoose
- Cors
- dotenv
- nodemon
Contributions are welcome! If you'd like to contribute to this project, please fork the repository and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.