games-api
Games API
- Base Path:
/api/v1/games - Auth: Endpoints marked "Auth: required" expect a valid
Authorizationheader. Public endpoints do not require auth.
Game Model
- _id: string (Mongo ObjectId)
- name: string
- description: string
- tabcode: string
- thumbnail: string
- status: 'DRAFT' | 'PUBLISHED'
- createdAt: string (ISO datetime)
- updatedAt: string (ISO datetime)
- __v: number
Example Game document:
{
"_id": "66d8c2c4e8d8b8a1f3a9d999",
"name": "Space Dash",
"description": "Dodge and sprint in space!",
"tabcode": "spacedash",
"thumbnail": "https://cdn.example.com/games/spacedash.png",
"status": "PUBLISHED",
"createdAt": "2025-09-03T12:30:11.222Z",
"updatedAt": "2025-09-03T12:30:11.222Z",
"__v": 0
}
List Published Games (Public)
- Method: GET
- Path:
/api/v1/games/published - Auth: not required
- Request Body: none
- Query: none
- Response 200: Array of Game documents (only those with
status = 'PUBLISHED'), sorted bycreatedAtdescending.
Example 200 response:
[
{
"_id": "66d8c2c4e8d8b8a1f3a9d999",
"name": "Space Dash",
"description": "Dodge and sprint in space!",
"tabcode": "spacedash",
"thumbnail": "https://cdn.example.com/games/spacedash.png",
"status": "PUBLISHED",
"createdAt": "2025-09-03T12:30:11.222Z",
"updatedAt": "2025-09-03T12:30:11.222Z",
"__v": 0
}
]
- Errors:
- 500: { "error": "Failed to fetch games" }
List All Games (Internal)
- Method: GET
- Path:
/api/v1/games - Auth: required
- Request Body: none
- Response 200: Array of Game documents (includes both
DRAFTandPUBLISHED). - Errors:
- 401: { "error": "UNAUTHORIZED", "message": "..." }
- 500: { "error": "Failed to fetch games" }
Notes
- Use the public endpoint for client apps that need to display selectable games.
- Admin management (create/update/delete) is available under
/api/admin/gamesand should be protected by your admin gateway.