Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DavFilsDev/pokemanager-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

43 Commits

Repository files navigation

PokéManager Server 🎮

Backend API for PokéManager application - Manage your custom Pokémon collection with battle system and XP tracking.

🚀 Technologies

  • Express - Web framework for Node.js
  • TypeScript - Type-safe JavaScript
  • File System - JSON file-based database
  • Axios - HTTP client for PokeAPI
  • CORS - Cross-Origin Resource Sharing
  • Morgan - HTTP request logger

📋 API Endpoints

Pokémon Collection

Method Endpoint Description
POST /api/pokemon Create a new Pokémon
GET /api/pokemon Get all Pokémon
GET /api/pokemon/:id Get Pokémon by ID
PUT /api/pokemon/:id Update Pokémon
DELETE /api/pokemon/:id Delete Pokémon
PUT /api/pokemon/:id/add-xp Add XP to Pokémon
POST /api/pokemon/:id/level-up Level up Pokémon
POST /api/pokemon/:id/nickname Update nickname
GET /api/pokemon/search Search Pokémon

Battle System

Method Endpoint Description
POST /api/battle/random/:pokemonId Battle vs random Pokémon
POST /api/battle/train Battle between your Pokémon
POST /api/battle/sparring/:pokemonId Training battle
GET /api/battle/random-opponent Get random opponent
GET /api/battle/available-opponents Get multiple opponents

Battle History

Method Endpoint Description
GET /api/battle/history Get all battle history
GET /api/battle/history/:pokemonId Get Pokémon battle history
GET /api/battle/stats/:pokemonId Get battle stats
DELETE /api/battle/history Clear battle history

Statistics

Method Endpoint Description
GET /api/stats/strongest Top strongest Pokémon
GET /api/stats/most-experienced Most experienced Pokémon
GET /api/stats/battle-winners Best win ratio
GET /api/stats/type-distribution Type distribution
GET /api/stats/collection Collection stats

🛠️ Installation

# Clone the repository
git clone https://github.com/yourusername/pokemanager-server.git
cd pokemanager-server
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start

📁 Project Structure

pokemanager-server/
├── src/
│ ├── controllers/ # Business logic
│ ├── routes/ # API routes
│ ├── middleware/ # Express middleware
│ ├── services/ # Data services
│ ├── utils/ # Helper functions
│ ├── types/ # TypeScript types
│ ├── data/ # JSON database
│ ├── app.ts # Express app
│ └── server.ts # Server entry point
├── .env # Environment variables
├── package.json
└── tsconfig.json

🔧 Environment Variables

Variable Description Default
PORT Server port 5000
NODE_ENV Environment development
CLIENT_URL Frontend URL http://localhost:5173
POKEAPI_URL PokeAPI URL https://pokeapi.co/api/v2

📦 Data Storage

The API uses JSON files for data persistence:

  • src/data/pokemon.json - Stores Pokémon and battle history

🧪 Testing with Postman

Import the Postman collection to test all endpoints:

PokéManager API Postman Collection

📄 License

MIT License - feel free to use this project for learning!

🙏 Acknowledgements

About

RESTful API service for custom Pokémon management, battle logic, XP systems, and integration with third-party Pokémon data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /