This Node.js application manages orders for an e-commerce platform using MongoDB. It includes functionality to add orders, update order statuses, and calculate monthly revenue.
-
Clone the Repository
git clone https://github.com/AshwiniRK/E-Commerce-App.git cd your-repository
npm install
Set Up MongoDB Update the MongoDB connection URI in config.js: // config.js module.exports = { mongoURI: 'mongodb://localhost:27017/your-database-name', };
POST /api/orders
{ "orderId": "string", "customerId": "string", "items": [ { "itemId": "string", "quantity": 1, "price": 9.99 } ], "orderDate": "2024-09-13T00:00:00Z", "status": "Pending" }
PATCH /api/orders/:orderId/status
Query Parameters:
month (required): The month to calculate revenue for (1-12). year (required): The year to calculate revenue for.
/api/revenue?month=9&year=2024
npm install --save-dev mocha chai
MongoDB for the database. Express for the server framework. Mongoose for the ODM (if used). Mocha and Chai for testing.