This repository contains a simple Express.js API that interacts with a MongoDB database using Mongoose. The API provides endpoints for retrieving product data and inserting new products.
Before running the application, ensure you have the following installed:
- Node.js
- MongoDB
-
Clone the repository:
git clone https://github.com/abhinav3254/QUOTE-API
-
Install dependencies:
npm install
-
Configure the MongoDB connection:
Update the
db-config.js
file with your MongoDB connection details. -
Run the application:
node index.js
The server will start running on the specified port (default: 4500).
- Endpoint:
GET /
- Description: Fetches all product data from the database.
- Response: JSON array containing product information.
- Endpoint:
POST /insert
- Description: Inserts a new product into the database.
- Request Body: JSON object representing the product to be inserted.
- Response: JSON object containing the result of the insertion.
curl http://localhost:4500
curl -X POST -H "Content-Type: application/json" -d '{"name": "New Product", "price": 29.99, "category": "Electronics"}' http://localhost:4500/insert
- Express.js: Web application framework
- Mongoose: MongoDB object modeling for Node.js
Feel free to contribute to the project by submitting issues or pull requests. Your feedback and contributions are highly appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.
Hello Everyone, This is an Basic API right now but we are trying to improve it day by day and I try to work on this API everyday,so that I can improve it.
- Get request
- Post request
Must have node.js in the system installed
install the pacakges
npm i express
npm i nodemon
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (git checkout -b feature/2. AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request