Skip to content

HlfDev/go_pokeapi_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon API

A simple REST API for Pokemon data built with Go and Gin.

Quick Start

# Install dependencies
go mod download

# Run the application
go run cmd/main.go

# Access Swagger UI
open http://localhost:8080/swagger/index.html

Features

  • REST API with Gin framework
  • Random Pokemon endpoint with data from PokeAPI
  • In-memory caching
  • Swagger documentation

Configuration

Set in .env file:

POKE_API_BASE_URL=https://pokeapi.co/api/v2/pokemon/

API Endpoints

Method Endpoint Description
GET /api/v1/pokemon/random Get a random Pokemon

Development

Regenerate Swagger Docs

# Using the provided script
./scripts/swagger.sh

# Or manually
go run github.com/swaggo/swag/cmd/swag init -g cmd/main.go

Project Structure

├── cmd/                 # Application entry
├── docs/                # Swagger docs
├── internal/            # Private code
│   ├── bootstrap/       # App initialization
│   ├── cache/           # Caching
│   ├── handlers/        # HTTP handlers
│   ├── logger/          # Logging
│   ├── models/          # Data models
│   ├── repositories/    # Data access
│   ├── routes/          # API routes
│   └── services/        # Business logic
└── scripts/             # Utility scripts

Testing

go test ./...

Docker

# Build
docker build -t pokemon-api .

# Run
docker run -p 8080:8080 pokemon-api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors