Template Golang API
- Go 98.1%
- Makefile 1.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| Makefile | ||
| README.md | ||
Go API
Small API built with Echo.
Run
make dev
make build
Server listens on :8080. Set HTTP_ADDR to override it.
GET /ping— publicGET /secret— protected; returns401GET /docs/index.html— Swagger UIGET /docs/doc.json— OpenAPI spec
Add endpoint
Add handler to internal/endpoints, then register it in internal/server:
e.GET("/hello", endpoints.Hello)
Route middleware goes after handler:
e.GET("/secret", endpoints.Secret, auth.Auth(authorize))
Add Swag annotations above handler, then regenerate docs:
make docs
Replace auth.DenyAll with proper auth handling.