Code Monkey home page Code Monkey logo

xendit-heroes's Introduction

Xendit Heroes Coding Challenge

APIs for getting all chacracters of Marvel using some caching tech to improve the performance.

APIs - Feature

  • /characters that returns all the Marvel character ids in a JSON array of numbers
  • /characters/{characterId} that returns only the id, name and description of the character.
  • /clear-cache-all manually clear all cache of application

OpenAPI Spec

  • Please get it from: api-doc/xendit-heroes.v1.yml

Online version on Heroku

Notes:

The Marvel API only returns a max of 100 records per request Therefore, we will use some form of caching in the first call to reduce latency in subsequent calls to this endpoint. Because new Marvel character may be added in the future, Therefore we added a duration time for our cache, Every time when user hit an API, we check the expiration and doing some algorithm to manage our cache

Tech

Pre Requires

  • node in latest version. Make sure your local is installed NodeJS
  • npm in latest version. Make sure your local installed npm
  • Make sure you config the variable correctly on .env: PUBLIC_KEY, PRIVATE_KEY and DURATION,here is the .env content:
PORT=YOUR_SERVER_PORT
PUBLIC_KEY=MAVEL_API_PUIBLIC_KEY
PRIVATE_KEY=MARVEL_API_PRIVATE_KEY
DURATION=CACHE_VALID_DURATION_TIME_IN_MINUTE
MARVEL_API_URL=MARVEL_API_URL

Installation

Install the dependencies and devDependencies and start the server.

cd xendit-heroes
npm install
npm run dev

For running the tests.

npm test

xendit-heroes's People

Contributors

nhduong29 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.