Box Management API This is a backend API service built in Go, using Gorilla Mux for routing, to manage users, transactions, and boxes—virtual containers for funds or items. Each user has personal details, boxes store financial data, and transactions log deposit and withdrawal activities, providing a structured system for user account and transaction management.
Table of Contents Features Project Structure Endpoints Getting Started Dependencies License Features User management: Add and retrieve users. Box management: Create, update, and delete boxes associated with users. Transaction handling: Record and manage transactions for transferring amounts in and out of boxes. Project Structure main.go: Entry point for the API. DataModel: Contains data structures representing Users, Boxes, and Transactions. Handlers: Defines the HTTP routes for managing entities. Endpoints The API exposes the following endpoints:
Users GET /users: Retrieve all users. POST /users: Add a new user. Boxes GET /boxes: Retrieve all boxes. POST /boxes: Create a new box. DELETE /boxes/{id}: Delete a box by ID. Transactions GET /transactions: Retrieve all transactions. POST /transactions: Record a new transaction. Getting Started Clone the repository:
sh Copy code git clone https://github.com/Mersad-Moghaddam/your-repo-name.git cd your-repo-name Install dependencies: Make sure Go modules are enabled. Run:
sh Copy code go mod tidy Run the server:
sh Copy code go run main.go The API will be accessible at http://localhost:8080.
Dependencies Gorilla Mux - Router for handling HTTP requests.