/pokedex-api

This is a simple API for a Pokedex. It allows you to retrieve information about Pokemon and search for them using a separate "validate" endpoint.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Pokedex API

CI/CD Docker Hub

This repository contains a RESTful API for a Pokedex that allows users to search for information about different Pokemon. The API is built using Node.js and Express, and data about the Pokemon is stored in JSON files.

Endpoints

The API has the following endpoints:

  • GET /:pokemon: returns information about the specified Pokemon.
  • GET /start/search: starts an interval that searches for a random Pokemon every second.
  • GET /stop/search: stops the interval started by /start/search.
  • GET /validate/pokemon: returns information about a random Pokemon if it is present in a pre-defined list.
  • GET /notfound: returns a 404 error.
  • GET /notavailable: returns a 502 error.

Usage

To use the API, you need to have Node.js and npm installed.

  1. Clone the repository:
$ git clone https://github.com/siorellana/pokedex-api.git
  1. Install the dependencies:
$ cd pokedex-api
$ npm install
  1. Start the server
$ npm start

The server should be listening at http://localhost:3000.

Tests

This repository includes some basic tests. To run them, you need to have jest and supertest installed.

  1. Install the development dependencies:
$ npm install --only=dev
  1. Run the tests:
$ npm test

Docker

This API is also available as a Docker image. To run it in a container, you need to have Docker installed.

  1. Pull the image from Docker Hub:
$ docker pull siorellana/pokedex-api
  1. Run a container with the image:
$ docker run -p 3000:3000 siorellana/pokedex-api

License

This project is licensed under the MIT License.

Contributors

  • @ChatGPT - OpenAI-trained conversational AI model

Copyright

This project is not affiliated with, endorsed, sponsored, or specifically approved by The Pokémon Company or its affiliates. Pokémon is a registered trademark of The Pokémon Company.