This repo contains an example of a HTTP API built using the blaze template.
It features a simple CRUD API for managing todos, including:
- A basic blaze scaffolding (including logging, configuration, structure...)
- Clean structure and dependency inversion
- SQL data storage using SQLite and sqlx
- Database migrations using goose
- Full Prometheus metrics instrumentation (enabled by environment variable)
Requirements:
- Go >= 1.22
- sqlite3
- goose
Before running, export the required environment variables for the service (see internal/api/env.go
) and for Goose (see .env.template
for all needed env).
To run the app, first create the database and apply the migrations:
goose up
Then build and run the API:
make
./bin/api/main
Done! The API will be available at http://localhost:3000
.
Prometheus metrics will be available at http://localhost:3000/metrics
.