Template of REST API server write by go.
Three layer architecture design: handler -> service -> repo
Block | Layer | Function |
---|---|---|
API / Route | 0 | Registered API endpoint. |
Middle ware | 0 | Common / routine functions such like token verify/generate, logging, etc. |
Handler | 1 | Parse necessary variables from URI and body, |
Service | 2 | Core business logic, include third-party client. |
DB Client | 3 | Repo layer. |
Redis Client | 3 | Redis client. |
$ make run
$ make all
$ make build
$ make swagger
$ docker-compose build
$ docker push allensyk/template7-backend:latest