Skip to content

ivantedja/xmarvel

Repository files navigation

xmarvel

codecov

Documentation

Xmarvel provides service to proxy request to Marvel's API (see: https://developer.marvel.com/)

Endpoints

  • /characters - Return list of Marvel's "characterId"
  • /characters/{characterId} - Return Marvel's character by {characterId}

Flows

List Character IDs /characters

List Character IDs

Show Character /characters/{characterId}

Show Character

API Doc

See on SwaggerHub

Prerequisites

  1. Install Docker Compose to setup dependencies
  2. Install Golang > 1.15
  3. Register to https://developer.marvel.com/ to get API credentials

Running

  1. Install dependencies
$ docker-compose up -d
  1. Prepare environment variables (adjust the credentials accordingly):
$ cp env.sample .env
  1. Generate binary:
$ make build
  1. 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

  1. Run via console:
$ make run

Test the endpoint:

$ curl localhost:8080/characters

Cache Warming

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

About

Xmarvel is a proxy for Marvel's API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published