Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itscodemen/sales_analysis
This is a demo Go project demonstrating GIN, Logging, Refresh cron job and Loading data from CSV to db
https://github.com/itscodemen/sales_analysis
gin gin-gonic go golang mysql
Last synced: 2 months ago
JSON representation
This is a demo Go project demonstrating GIN, Logging, Refresh cron job and Loading data from CSV to db
- Host: GitHub
- URL: https://github.com/itscodemen/sales_analysis
- Owner: itscodemen
- Created: 2024-07-27T09:24:25.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-27T09:34:22.000Z (5 months ago)
- Last Synced: 2024-09-29T12:05:36.475Z (3 months ago)
- Topics: gin, gin-gonic, go, golang, mysql
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Sales Analysis API
A RESTful API for analyzing historical sales data using Go, Gin framework, and MySQL.
## Prerequisites
- **Go 1.16+**
- **MySQL**## Setup
1. **Clone the Repository:**
```bash
git clone
cd sales-analysis
```2. **Set Up Environment Variables:**
Create a `.env` file with:
```env
DB_USER=
DB_PASSWORD=
DB_NAME=
DB_HOST=
DB_PORT=
```3. **Install Dependencies:**
```bash
go mod tidy
```4. **Run the Application:**
```bash
go run main.go
```The server will start on port `8080`.
## API Endpoints
### Get Total Revenue
- **URL:** `/revenue`
- **Method:** `GET`
- **Query Parameters:**
- `start_date`: `YYYY-MM-DD`
- `end_date`: `YYYY-MM-DD`### Sample Request
```http
GET /revenue?start_date=2023-01-01&end_date=2023-12-31