Toy is an example of a tiny microservice built with SOLID & DDD principles.
It's separation of concerns, allows to potentially plug-in other transports implementations like GRPC or AMQP re-using the same business logic.
- saves toys in memory by their
name
anddescription
. - returns all the available toys. An error is returned if the number of toys is
odd
. - deletes the oldest toy.
Endpoint | Method | Body | HTTP Status Codes |
---|---|---|---|
/ | Get | [{"name": "Jotaro Kujo Action Figure","description": "Action Figure"}] |
200 |
/ | Put | {"name": "Dio Action Figure","description": "Action Figure"}] |
201, 400 |
/ | Delete | 200 |
- go: ~v1.14
- docker: ~v18.09.9
- docker-compose: ~v1.23.2
make run
: runs the app on port:8080
make stop
: stops the appmake build
: builds the applicationmake test
: runs all go testsmake vendor
: downloads golang vendors