115 lines
2.0 KiB
Markdown
115 lines
2.0 KiB
Markdown
# Setup Anleitung
|
|
|
|
Quick Start Guide für das OMS
|
|
|
|
## Voraussetzungen
|
|
|
|
- Node.js 18+
|
|
- npm
|
|
- Docker (optional)
|
|
|
|
## Installation
|
|
|
|
### Variante 1: Docker (empfohlen)
|
|
|
|
```bash
|
|
docker compose up
|
|
```
|
|
|
|
Das war's!
|
|
- Backend läuft auf http://localhost:3990
|
|
- Frontend läuft auf http://localhost:3980
|
|
|
|
### Variante 2: Lokal
|
|
|
|
```bash
|
|
# Dependencies installieren
|
|
npm run install:all
|
|
|
|
# In zwei separaten Terminals:
|
|
npm run dev # Backend (Terminal 1)
|
|
npm run dev:frontend # Frontend (Terminal 2)
|
|
```
|
|
|
|
## API Testen
|
|
|
|
### Mit Browser
|
|
1. Frontend öffnen: http://localhost:3980
|
|
2. Formular ausfüllen
|
|
3. Bestellung abschicken
|
|
|
|
### Mit curl
|
|
```bash
|
|
curl -X POST http://localhost:3990/orders \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"customerId": "DW001",
|
|
"customerName": "Lui Denkwerk",
|
|
"customerEmail": "lui@test.de",
|
|
"items": [{
|
|
"productId": "TISCH1",
|
|
"quantity": 1,
|
|
"price": 200.80
|
|
}],
|
|
"shippingAddress": {
|
|
"street": "Hauptstr. 1",
|
|
"city": "Grevenbroich",
|
|
"postalCode": "41515",
|
|
"country": "DE"
|
|
}
|
|
}'
|
|
```
|
|
|
|
## Tests ausführen
|
|
|
|
```bash
|
|
npm test
|
|
```
|
|
|
|
## Production Build
|
|
|
|
```bash
|
|
npm run build
|
|
npm start
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Port schon belegt
|
|
Backend läuft auf Port 3990
|
|
Frontend auf 3980
|
|
|
|
Ändern in:
|
|
- `backend/src/server.ts` -> PORT Konstante
|
|
- `frontend/vite.config.ts` -> proxy config
|
|
|
|
### DB Fehler
|
|
Die SQLite DB wird automatisch unter `./data/orders.db` erstellt.
|
|
Falls Probleme: `rm -rf data/` und neu starten
|
|
|
|
### Docker Probleme
|
|
```bash
|
|
docker compose down
|
|
docker compose build --no-cache
|
|
docker compose up
|
|
```
|
|
|
|
## Wichtige Hinweise
|
|
|
|
- SQLite DB wird beim ersten Start automatisch angelegt
|
|
- Events werden in der Console geloggt (Simulation)
|
|
- Backend Port ist 3990
|
|
- Frontend Proxy leitet `/orders` requests an Backend weiter
|
|
- In Production PostgreSQL statt SQLite verwenden
|
|
|
|
## Nächste Schritte
|
|
|
|
Für Production:
|
|
1. PostgreSQL Setup
|
|
2. Environment Variables (`.env`)
|
|
3. JWT Auth implementieren
|
|
4. Message Queue für Events
|
|
5. Monitoring Setup
|
|
6. CI/CD Pipeline
|
|
|
|
--- |