Basit örnek: React ana sayfa, backend AppSettings:DisplayMessage değerini API üzerinden gösterir.
backend/TestProject.Api— ASP.NET Core API (AppSettings:DisplayMessage,/health,/api/config)backend/Greeting.Api— ayrı ASP.NET Core API (/health,/api/message→ statik “Merhaba dünya”)frontend— React (Vite);dist/üretilmiş statik çıktı
Backend
cd backend/TestProject.Api
dotnet run- Health:
http://localhost:8080/health - API:
http://localhost:8080/api/config - Remote API örneği (
IHttpClientFactory):http://localhost:8080/api/remote/google
TestProject.Api içinde Redis ve RabbitMQ istemcileri dependency injection'a
kayıtlıdır. Varsayılan localhost ayarları appsettings.json dosyasındadır:
- Redis:
localhost:6379 - RabbitMQ:
amqp://guest:guest@localhost:5672/ - Google remote API:
https://www.google.com/
Redis ve RabbitMQ bağlantıları ihtiyaç duyulana kadar oluşturulmadığı için bu servisler kapalıyken de API başlatılabilir.
Konteyner / Docker imajında dinlenen port 8080 (ASPNETCORE_HTTP_PORTS).
Frontend (geliştirme)
cd frontend
npm install
npm run devVite proxy: /api → http://localhost:8080, /greeting-api → http://localhost:8081
Greeting API (geliştirme)
cd backend/Greeting.Api
dotnet run- Health:
http://localhost:8081/health - API:
http://localhost:8081/api/message
Frontend build
cd frontend
npm install
npm run buildAPI, configuration key AppSettings:DisplayMessage okur. Linux konteyner / compose ortamında:
AppSettings__DisplayMessage=Vault'tan gelen metinAppGraph vault binding:
| Alan | Değer |
|---|---|
| Anahtar | AppSettings__DisplayMessage |
| Secret | newproject (örnek) |
Vault KV alan adı da aynı olmalı: AppSettings__DisplayMessage
Production’da React fetch('/api/config') ve fetch('/greeting-api/api/message') kullanır; reverse proxy:
/api→ TestProject.Api servisi/greeting-api→ Greeting.Api servisi (pass-through, path öneki korunur veya upstream’e rewrite edilir)