Xmarvel provides service to proxy request to Marvel's API (see: https://developer.marvel.com/)
/characters
- Return list of Marvel's "characterId"/characters/{characterId}
- Return Marvel's character by{characterId}
See on SwaggerHub
- Install Docker Compose to setup dependencies
- Install Golang > 1.15
- Register to https://developer.marvel.com/ to get API credentials
- Install dependencies
$ docker-compose up -d
- Prepare environment variables (adjust the credentials accordingly):
$ cp env.sample .env
- Generate binary:
$ make build
- Run via console:
$ ./bin/main
OR alternatively you can directly run the application without generating the binary. Step no 3 can be directly changed into
- Run via console:
$ make run
Test the endpoint:
$ curl localhost:8080/characters
Xmarvels contains characters' cache which rarely changed. To keep the cache warm in the background, we can setup a cron to warm it up regularly.
Assuming you already have the binary from make build
command, we can set a cron that runs hourly:
0 * * * * ./bin/warmer