Introduced detailed documentation for the API Gateway, including its configuration and responsibilities in the system (e.g., routing, security, and cross-cutting concerns). Added a README for the core model directory to define its structure and workflow. Created a new backend README to describe its components and their documentation structure. Simplified and clarified legacy specifications for archiving purposes.
34 lines
1.2 KiB
Markdown
34 lines
1.2 KiB
Markdown
# Infrastruktur: API-Gateway
|
|
|
|
Dieses Dokument beschreibt die Konfiguration und die Aufgaben des API-Gateways im "Meldestelle"-Projekt.
|
|
|
|
## Zweck
|
|
|
|
Das API-Gateway (implementiert mit Spring Cloud Gateway) ist der zentrale, nach außen exponierte Einstiegspunkt für alle HTTP-Anfragen an das System.
|
|
|
|
Seine Hauptaufgaben sind:
|
|
* **Routing:** Leitet Anfragen an den korrekten Microservice weiter (z.B. `/api/ping/**` -> `ping-service`).
|
|
* **Security:** Erzwingt die Authentifizierung und Autorisierung für alle eingehenden Anfragen. Es validiert die von Keycloak ausgestellten JWTs.
|
|
* **Cross-Cutting Concerns:** Implementiert übergreifende Funktionalitäten wie Rate Limiting, Logging und Circuit Breaking (mit Resilience4j).
|
|
|
|
## Konfiguration
|
|
|
|
Die Routen werden in der `application.yml` des Gateways definiert. Die Konfiguration für die Service Discovery erfolgt über Consul.
|
|
|
|
```yaml
|
|
spring:
|
|
cloud:
|
|
gateway:
|
|
discovery:
|
|
locator:
|
|
enabled: true
|
|
lower-case-service-id: true
|
|
routes:
|
|
- id: ping-service
|
|
uri: lb://ping-service
|
|
predicates:
|
|
- Path=/api/ping/**
|
|
filters:
|
|
- StripPrefix=2
|
|
```
|