A RESTful API for analyzing historical sales data using Go, Gin framework, and MySQL.
- Go 1.16+
- MySQL
-
Clone the Repository:
git clone <repository-url> cd sales-analysis
-
Set Up Environment Variables:
Create a
.env
file with:DB_USER=<your_db_user> DB_PASSWORD=<your_db_password> DB_NAME=<your_db_name> DB_HOST=<your_db_host> DB_PORT=<your_db_port>
-
Install Dependencies:
go mod tidy
-
Run the Application:
go run main.go
The server will start on port
8080
.
- URL:
/revenue
- Method:
GET
- Query Parameters:
start_date
:YYYY-MM-DD
end_date
:YYYY-MM-DD
GET /revenue?start_date=2023-01-01&end_date=2023-12-31