1.0 KiB
1.0 KiB
Die MySQL-Datenbank und die Slim-REST-API sind eingerichtet und getestet.
Datenbank nerdshop (MAMP, Port 8889) enthält die Tabelle products mit den 13 Einträgen aus der JSON-Datei. Die Mongo-IDs bleiben als id erhalten; die API liefert sie als _id, damit die React-App kompatibel bleibt.
API läuft auf http://localhost:8080
| Methode | URL | Status |
|---|---|---|
GET |
/products |
alle Produkte |
GET |
/products/{id} |
ein Produkt |
POST |
/products |
anlegen |
PUT |
/products/{id} |
aktualisieren |
DELETE |
/products/{id} |
löschen |
CORS ist für http://localhost:5173 (Vite) gesetzt. In der React-App reicht später:
fetch('http://localhost:8080/products');
Server neu starten:
cd slim-php-framework
php -S localhost:8080 -t public public/router.php
Falls MAMP andere Zugangsdaten nutzt, stehen sie in slim-php-framework/.env.