(Docker - Makefile - golang)
BoxSize is a golang micro-service to compute the volume contains inside a box.
It accepts tree integers as parameters : height, width, length.
Then the service returns two strings with two informations : The box size in cm³ and the corresponding box capacity in liters.
If 42 is a number somewhere, we raise an error because it's a special number.
You can build and run the service inside a Docker. The makefile has a docker-build and a docker-run commands.
$> make docker-build
$> make docker-run
+ exec app
BoxSize Server will run on port 3000
If you prefer avoid docker, feel free to run :
make run
Query :
curl -XPOST -d '{"height": 1, "width": 3, "length": 2}' localhost:3000Answer :
{"results":["The box volume is 6 cm³","It's also 0 liters."]}Query :
curl -XPOST -d '{"height": 1, "width": 42, "length": 2}' localhost:3000Answer :
The box mensuration can't have a 42 number
Query :
curl -XPOST -d '{"bad_stuff": 123}' localhost:3000Answer :
An error occured while decoding the json format request.