Toronto Time API
A Go-based API that provides the current time in Toronto and logs all requests to a MySQL database.
Features
- Get current Toronto time
- Log all time requests to MySQL database
- Retrieve time request history
- Docker containerization
- Structured logging
Prerequisites
Quick Start
-
Clone the repository
-
Run the application:
docker-compose up --build
API Endpoints
GET /current-time
: Returns the current time in TorontoGET /time-logs
: Returns the history of time requests
Environment Variables
The following environment variables can be configured in docker-compose.yml:
DB_HOST
: MySQL hostDB_USER
: Database usernameDB_PASSWORD
: Database passwordDB_NAME
: Database name
Development
To run tests: