This project implements a simple budget envelope system using Node.js and Express. It allows users to manage budget envelopes and perform operations like creating, retrieving, updating, transferring, and deleting envelopes. This README outlines the steps to set up and interact with the API.
- Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine.
- Express: A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- Git: A distributed version control system to handle project versioning.
- GitHub: A platform for version control and collaboration.
- Postman: A tool used to test APIs during development.
- Node.js
- npm (Node package manager)
- Git
- Postman (for testing the API)
- Clone the repository: git clone https://github.com/vivekvardhank/Envelope_backend.git.
- cd Envelope_backend.
- npm install.
- npm start.
Each endpoint manipulates or displays information related to the budget envelopes:
- GET
/- Functionality: Retrieves all budget envelopes.
- Response Example:
[ {"id": 1, "name": "Groceries", "budget": 300}, {"id": 2, "name": "Rent", "budget": 1200} ]
- POST
/- Middleware:
validateRequest- Ensures all required fields are present and valid. - Request Example:
{"name": "Utilities", "budget": 150} - Response Example:
{"id": 3, "name": "Utilities", "budget": 150}
- Middleware:
- POST
/:fromId/:toId- Parameters:
fromId: ID of the envelope to transfer funds from.toId: ID of the envelope to transfer funds to.
- Request Example:
{"amount": 50} - Response Example:
{"message": "Transfer successful"}
- Parameters:
- PUT
/:id- Parameters:
id- ID of the envelope to update. - Request Example:
{"name": "Entertainment", "budget": 250} - Response Example:
{"id": 1, "name": "Entertainment", "budget": 250}
- Parameters:
- DELETE
/:id- Parameters:
id- ID of the envelope to delete. - Response Example:
{"message": "Envelope deleted"}
- Parameters: