Skip to content

michaelmaysonet74/pokedex-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pokedex-api

Microservice for fetching Pokémon data.

Getting Started

Requirements

Elixir v1.18.0

Usage

Install dependencies:

mix deps.get

Start the server:

mix run --no-halt

The application will start on http://localhost:8080.

Docker

If you prefer to run this service in a Docker container, you can do so by following these steps:

Build the Docker image:

docker build -t pokedex_api .

Run the Docker container:

docker run -p 8080:8080 pokedex_api

API Endpoints

  • Get Pokemon by ID

    • URL: /api/v1/pokemon/{id}
    • Method: GET
    • Description: Fetches information about a Pokemon by its ID.
  • Get Pokemon by Name

    • URL: /api/v1/pokemon?name={name}
    • Method: GET
    • Description: Fetches information about a Pokemon by its name.

Example Requests

  • Fetch Pokemon by ID:

    curl -X GET "http://localhost:8080/api/v1/pokemon/25"

  • Fetch Pokemon by Name:

    curl -X GET "http://localhost:8080/api/v1/pokemon?name=Pikachu"

GraphQL Support

This project also includes support for GraphQL.

GraphQL Endpoint

  • URL: /graphql
  • Method: POST
  • Description: Endpoint to handle GraphQL queries.

Example GraphQL Queries

  • Query Pokemon by ID:
query {
  pokemon_by_id(id: 25) {
    id
    name
    types
    # Add more fields here
  }
}
  • Query Pokemon by Name:
query {
  pokemon_by_name(name: "Pikachu") {
    id
    name
    types
    # Add more fields here
  }
}

About

Microservice for fetching Pokémon data.

Resources

Stars

Watchers

Forks

Packages

No packages published