brucruz / pokedex-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pokédex API

Description

This is a simple API that allows you to get information about pokemons. Its data is obtained from the PokemonDb.

Running locally

Before you start to run the API locally, you should have a AWS account, an IAM user and the AWS CLI installed on your machine. Here are the steps to get this done if you don't have it already:

Then, you need to have Node.js and pnpm installed on your machine. If you don't have pnpm, you can installed using npm:

npm install -g pnpm

Then, you can clone this repository and run the following commands:

pnpm install

Once you have all the package dependencies installed, you can run the API with the following command:

npm dev

You may be prompted to enter a personal stage name. You can enter any name you want, such as:

## Please enter a name you’d like to use for your personal stage. Or hit enter to use dev:
dev

Once you enter the name, the SST framework will deploy the API to your AWS account. You can check the progress of the deployment in the terminal. Once the deployment is done, you should see a message like this:

✔  Deployed:
   API
   ApiEndpoint: https://xknbm8zem2.execute-api.us-east-1.amazonaws.com

✔  Built

Endpoints

A live production version of this API is being hosted at AWS and is available at https://ucbyh1kpqf.execute-api.us-east-1.amazonaws.com.

  • GET /pokemon/all: Returns a list of all pokemons. This endpoint is paginated and you can pass the limit and offset query parameters to get the next page of results.
  • GET /pokemon/<name>: Returns the information of a pokemon given its name.
  • GET /pokemon/id/<id>: Returns the information of a pokemon given its id.
  • GET /scraper: Scrapes the PokemonDb and returns a list of its pokemons.

Improvements to be made

This API is still under development and there are some improvements to be made:

  • Add pagination to the /pokemon/all endpoint
  • Add a /pokemon/type/<type> endpoint to get all pokemons of a given type
  • Fetch more information from each Pokémon
  • Add better error handling
  • Add more descriptive return logs to improve developer experience in searching logs in Cloudwatch

About


Languages

Language:TypeScript 91.5%Language:Shell 4.3%Language:JavaScript 4.2%