coma / bishop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bishop (code challenge)

Our objetive is create an api that joins different sources of data.

Clash: http://www.clashapi.xyz/api/cards/{id} // json

  • images: /images/cards/{id|idName}.png

Pokemon: https://pokeapi.co/api/v2/pokemon/{id} // json

Drivers: http://ergast.com/api/f1/drivers/{id} // xml

  • url: Driver:url

Prologue

In this exercise, app is based on: Express. If you are not familiar with it you can check the documentation in the following link:

Around these libraries, we've created a few components and basic structure for the project. Here we have some highlights of the structure of the project.

  • /controllers As any other express application you can find under this folder basic routers for different entities.

Run

First at all, clone the repo using the button at the top. Or if you prefer, you can fork the project.

screen shot 2019-01-09 at 5 49 43 pm

Then, you need to install all the packages npm install. If you want to start, you can run the application with npm start.

Exercise

Create an endpoint called items. This endpoint shall group all the information previously mentioned. The goal is normalize the output of those APIs. In order to do that, we are going to reduce the information provided to:

  • id unique id which is going to be used for more information
  • name display name

Then our endpoint /items/ is going to return a JSON with the next structure:

[
    {
        "id": "some-id",
        "name": "whatever",
    },
    ...
]

Next steps

Aditionally, our clients want to retrieve a little more information from this items. To achieve that goal, we are going to create and endpoint for that purpose.

/items/:id

In this case, we want to reply with the following structure:

{
    "id": "some-id",
    "image": "://url/to/image",
    "name": "whatever",
}

As our drivers API doesn't have any images, we are going to display in image field the url for their wikipedia sites.

Tips

Optional

  • Use some cache system
  • Use some reverse id system

About


Languages

Language:JavaScript 100.0%