This is a simple CRUD API built using Express.js and MongoDB. It allows you to perform basic CRUD operations (Create, Read, Update, Delete) on products.
- Create a new product
- Read a list of products
- Update an existing product
- Delete a product
- Node.js (Version 18.17.1)
- MongoDB (Version 7.4.5)
-
Clone the repository:
git clone git@github.com:geekyharsh05/Express-CRUD-API.git cd Express-CRUD-API
-
Install the dependencies:
npm install
-
Set up your MongoDB connection by modifying the mongoose.connect line in
db/connection.js
.
-
Start the server:
npm start
-
Access the API using http://localhost:4500 (or the port you've configured).
POST /api/v1/product/new
: Create a new product.GET /api/v1/products
: Fetch a list of all products.PUT /api/v1/product/:id
: Update a product by ID.DELETE /api/v1/product/:id
: Delete a product by ID.
Contributions are welcome! If you find any bugs or want to add new features, feel free to open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/your-feature-name
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a pull request.