This is a full-stack expense tracker application built with the MERN stack (MongoDB, Express, React, Node.js). This App allows the user to track their expenses by creating, reading, updating and deleting expense entries. This project contains two main structures: as a backend entry and a frontend.
server.js: Entry point of the backend server. routes/expenseRoutes.js: Defines the API routes for managing expenses. controllers/expenseController.js: Contains the logic for handling API requests.
backend
folder:
cd backend
npm install
.env
file and add your MongoDB URI:
MONGO_URI=your_mongodb_connection_string
npm run dev
src/App.js: Main React component for the application. public: Contains static files and the HTML template.
frontend
folder:
cd frontend
npm install
npm start
npm install concurrently
npm start
This command will use concurrently to start both the frontend and backend servers. The frontend will be available at http://localhost:3000 and the backend will be running on http://localhost:5000.
This project is licensed under the MIT License - see the LICENSE file for details.
Get All Expenses URL: /api/expenses Method: GET Response: Array of expense objects Get Expense by ID URL: /api/expenses/:id Method: GET Response: Expense object Create Expense URL: /api/expenses Method: POST Body: JSON object containing description, amount, and date Response: Created expense object Update Expense URL: /api/expenses/:id Method: PUT Body: JSON object containing description, amount, and date Response: Updated expense object Delete Expense URL: /api/expenses/:id Method: DELETE Response: 204 No Content Project Structure server.js: Entry point of the backend server. routes/expenseRoutes.js: Defines the API routes for managing expenses. controllers/expenseController.js: Contains the logic for handling API requests.
Any bugs, or issues , or any contributions are welcome, please feel free to suggest any changes or troubleshooting.