Simple go-application that interacts with different open api's to create text that you can receive on GET endpoints. See swagger.yml.
It uses gin web framework to handle http requests. For logging it uses logrus.
Testing of funny.go is done using dependency injection. Mocking of httpclient is done using mockgen.
Testing of router.go is done using package httptest.
Use make to build the application:
make build
Use make to build the application in docker:
make docker-build
The application will be put in the build folder. To run it invoke:
export PORT="18080"
./build/go-funny-endpoints
Use docker-compose to start the application:
docker-compose up -d
$ curl http://localhost:18080/v1/advice
{"message":"If you don't want something to be public, don't post it on the Internet."}
$ curl http://localhost:18080/v1/chucknorris
{"message":"there is no use crying over spilled milk, unless its Chuck Norris' milk because then your gonna die"}
$ curl http://localhost:18080/v1/dadjoke
{"message":"What do you call an eagle who can play the piano? Talonted!"}
$ curl http://localhost:18080/v1/random
{"message":"Advice: When painting a room, preparation is key. The actual painting should account for about 40% of the work."}