Files
api-duneawa/README.md
2026-05-10 19:40:57 +02:00

74 lines
1.9 KiB
Markdown

# Dune API
Node.js API for Dune: Awakening Questlog data. It imports items, skills, recipes, placeables, and NPCs in English and German into MongoDB, then exposes them through REST endpoints and Swagger UI.
## Quick Start
```powershell
npm install
npm run import:smoke
npm start
```
Open Swagger UI locally at `http://localhost:3030/docs`.
## Docker
```powershell
docker compose up --build
```
The container listens on `3030` and Docker Compose exposes it on `8030` by default. Set `API_HOST_PORT=3031` if your machine needs the alternate host port.
## Public HTTPS Domains
This app is configured for Dokploy/Traefik HTTPS by default. Traefik should terminate TLS and route both public HTTPS domains to the app container:
```text
https://dune.api.coppnic.cc -> container port 3030
https://ui.dune.api.coppnic.cc -> container port 3030
```
The public API URL is `https://dune.api.coppnic.cc`. Swagger UI is available at `https://ui.dune.api.coppnic.cc/docs`.
The OpenAPI document advertises the HTTPS API domain by default, so Swagger requests go to the right public API host. These values can be adjusted through environment variables:
```env
PUBLIC_API_URL=https://dune.api.coppnic.cc
PUBLIC_UI_URL=https://ui.dune.api.coppnic.cc
FORCE_HTTPS=true
```
## Import All Data
```powershell
npm run import
```
You can also call the script directly with filters:
```powershell
node scripts/import.js --datasets=items,skills --languages=en,de --max-pages=1
```
or call `POST /api/import` from Swagger UI with an empty JSON body:
```json
{}
```
The importer pulls every page for all configured datasets and both supported languages by default.
## Endpoints
- `GET /health`
- `GET /docs`
- `GET /openapi.json`
- `GET /api/{dataset}`
- `GET /api/{dataset}/{id}`
- `GET /api/search?q=...`
- `POST /api/import`
- `GET /api/import/status`
Datasets: `items`, `skills`, `recipes`, `placeables`, `npcs`.