This commit is contained in:
28
webseite-react-php/slim-php/README.md
Normal file
28
webseite-react-php/slim-php/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
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](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:
|
||||
|
||||
```js
|
||||
fetch('http://localhost:8080/products');
|
||||
```
|
||||
|
||||
Server neu starten:
|
||||
|
||||
```bash
|
||||
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`.
|
||||
Reference in New Issue
Block a user