"Life is like the game of Go. The board is empty at the beginning, but gradually fills with possibilities - and only the wise know when to play and when to pass." — Ancient Chinese Proverb
A simple REST API service that provides AI-generated inspirational quotes using Go and OpenAI's GPT API.
- Go (Golang)
- OpenAI GPT API
- Gin Web Framework
- Go 1.x
- OpenAI API key
- Clone this repository
- Create a
.env
file in the root directory:OPENAI_API_KEY=your-api-key-here
- Run
make build
to build the application - Run
make run
to start the server
make build
- Build the applicationmake run
- Run the built binarymake run-local
- Run directly with Gomake test
- Run all testsmake test-coverage
- Run tests with coverage reportmake clean
- Clean build artifactsmake clear-cache
- Clear the quote cache
Welcome message and API instructions
{
"message": "Welcome! Please hit the `/quote-of-the-day` API to get the quote of the day."
}
Returns an AI-generated inspirational quote (cached daily)
{
"message": "Your quote here - Author"
}
Clears the current quote cache
{
"message": "Cache cleared successfully"
}
{
"error": "Error message here"
}
Run tests:
make test
# With coverage report
make test-coverage
Coverage report is generated as coverage.html
.