Template Golang API
  • Go 98.1%
  • Makefile 1.9%
Find a file Use this template
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-25 00:19:16 -06:00
docs Initial commit 2026-06-24 14:19:22 -06:00
internal Initial commit 2026-06-24 14:19:22 -06:00
.gitignore Initial commit 2026-06-24 14:19:22 -06:00
go.mod Initial commit 2026-06-24 14:19:22 -06:00
go.sum Initial commit 2026-06-24 14:19:22 -06:00
LICENSE Create LICENSE 2026-06-25 00:19:16 -06:00
main.go Initial commit 2026-06-24 14:19:22 -06:00
Makefile Initial commit 2026-06-24 14:19:22 -06:00
README.md Initial commit 2026-06-24 14:19:22 -06:00

Go API

Small API built with Echo.

Run

make dev
make build

Server listens on :8080. Set HTTP_ADDR to override it.

  • GET /ping — public
  • GET /secret — protected; returns 401
  • GET /docs/index.html — Swagger UI
  • GET /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.