A simple Todo list server implementation, but explores:
- Gomodules for dep management
- DDD-esque go-style project structuring
- Pure
domain
module holds models, repos and services infra
module holds tech-specificdomain
implementationsapi
module defines controllers and modules, and usesdomain
constructsapp
instantiates and holds components needed booting up a server inmain.go
; this module also knows about the concreteinfra
and web framework used (kept web framework separate frominfra
because it's top-level and can change independently of other tech relatively easily)
- Pure
- Go test, with an eye on maximising testability by enabling mocking of interfaces.
- Auto-generated Swagger/OpenAPI clients via Swaggo
- Easy to understand dependency-injection by building a components graph by hand
- The Gin web framework
- Install
Go
- Clone this repo
go run main.go
and hit the endpoints.
- For Swagger, go to localhost:8080/swagger/index.html
- Install
Go
- Use your favourite editor/IDE
- For updating Swagger docs:
- Install Swaggo
- Run
swag init
from the root project dir - Commit the generated files.