Files
trade-frontend/README.md

38 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# trade-frontend
Frontend (SPA) + prosty serwer (basic auth + proxy do `trade-api`).
## Dev
W tym repo app jest w `apps/visualizer/`.
```bash
cd apps/visualizer
npm ci
npm run dev
```
### Dev z backendem na VPS (staging)
Najprościej: trzymaj `VITE_API_URL=/api` i podepnij Vite proxy do VPS (żeby nie bawić się w CORS i nie wkładać tokena do przeglądarki):
```bash
cd apps/visualizer
API_PROXY_TARGET=https://trade.mpabi.pl \
npm run dev
```
Vite proxyuje wtedy: `/api/*`, `/whoami`, `/auth/*`, `/logout` do VPS. Dodatkowo w dev usuwa `Secure` z `Set-Cookie`, żeby sesja działała na `http://localhost:5173`.
Jeśli staging jest dodatkowo chroniony basic auth (np. Traefik `basicAuth`), ustaw:
`API_PROXY_BASIC_AUTH='USER:PASS'` albo `API_PROXY_BASIC_AUTH_FILE=tokens/frontend.json` (pola `username`/`password`).
## Docker
```bash
docker build -t trade-frontend .
docker run --rm -p 8081:8081 trade-frontend
```
Jeśli auth jest realizowany przed aplikacją (np. Traefik `basicAuth`), ustaw `BASIC_AUTH_MODE=off`, żeby wyłączyć wbudowany basic auth w serwerze.