This API provides comprehensive access to Pokémon data:
- Fetch Pokémon: List all, by ID, or by name
- Manage Pokémon: Create, update, and delete Pokémon entries
- Types: Query all Pokémon types
- Seeding: Populate the database with types from PokeAPI
| Method | Endpoint | Description |
|---|---|---|
| GET | /pokemon |
List all Pokémon |
| GET | /pokemon/:id |
Get Pokémon by ID |
| GET | /pokemon/name/:name |
Get Pokémon by name |
| POST | /pokemon |
Create a new Pokémon |
| PATCH | /pokemon/:id |
Update a Pokémon |
| DELETE | /pokemon/:id |
Delete a Pokémon |
| GET | /type |
List all types |
| GET | /type/:id |
Get type by ID |
| POST | /seeder |
Seed types from PokeAPI |
- Node.js 20+
- MongoDB (local or Atlas)
- pnpm (recommended) or npm/yarn
# Clone the repository
git clone https://github.com/NoistNT/Pokemon-API.git
# Navigate to the project
cd Pokemon-API
# Install dependencies
pnpm installCreate a .env file:
MONGODB_URI=your_mongodb_connection_string
BASE_URL=https://pokeapi.co/api/v2
CORS_ORIGIN=https://your-frontend.vercel.app
SEEDER_API_KEY=your_secure_api_key
TOTAL_POKEMONS=1281
PORT=3000# Development
pnpm start:dev
# Production
pnpm build && pnpm start:prodBefore using the API, seed the types:
curl -X POST https://your-api.com/seeder \
-H "Content-Type: application/json" \
-H "x-api-key: your_seeder_api_key"- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request