993 B
993 B
Pokedex README
A simple Go-powered REST API kata.
HTTP Server
- KISS: Use built-in
http
package. https://gin-gonic.com/ looks cooler but also adds dozens of dependencies 😮 No need for a "fully-featured" web framework.
Protobuf
Why? Separation of concerns; do not expose database/domain internals. Structs in pokemon.go
should not leave the package. The .proto
file serve as the official "contracts".
- JSON mapping: https://protobuf.dev/programming-guides/proto3/#json
Pokemons
as object withentries
is ugly but see https://github.com/golang/protobuf/issues/675 - no way to convert a slice to a protobuf message...
Swagger
- Exposed at
http://localhost:8080/docs
- Regenerate with
swag init
, see https://github.com/swaggo/http-swagger - Annotation format: see https://github.com/swaggo/swag
Optimizing the binary
See Makefile
; use https://upx.github.io/ to package after stripping some debug info.
Somehow doesn't work on OSX (process killed)?