File tree Expand file tree Collapse file tree
DotnetDevopsPipeline.AdminUI Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55// Add services to the container.
66builder . Services . AddControllersWithViews ( ) ;
77builder . Services . AddHttpClient < DashboardApiService > ( ) ;
8- builder . Services . AddHttpClient < DashboardApiService > ( ) ;
98builder . Services . AddHttpClient < LogsApiService > ( ) ;
109
1110var app = builder . Build ( ) ;
Original file line number Diff line number Diff line change @@ -10,14 +10,28 @@ public class LogsApiService
1010 public LogsApiService ( HttpClient httpClient )
1111 {
1212 _httpClient = httpClient ;
13+
14+ // ✅ PROD API BASE ADDRESS
15+ _httpClient . BaseAddress = new Uri ( "https://dotnet-devops-pipeline.onrender.com/" ) ;
1316 }
1417
1518 public async Task < List < string > > GetLogsAsync ( int take = 200 )
1619 {
17- var url = $ "https://dotnet-devops-pipeline.onrender.com/api/v1/logs?take={ take } ";
18- var response = await _httpClient . GetFromJsonAsync < List < LogEntryDto > > ( url ) ;
20+ try
21+ {
22+ var url = $ "api/v1/logs?take={ take } ";
23+ var response = await _httpClient . GetFromJsonAsync < List < LogEntryDto > > ( url ) ;
1924
20- return response ? . Select ( x => x . Raw ) . ToList ( ) ?? new List < string > ( ) ;
25+ return response ? . Select ( x => x . Raw ) . ToList ( ) ?? new List < string > ( ) ;
26+ }
27+ catch
28+ {
29+ // ✅ 404, bağlantı hatası vs. UI’yi patlatmasın
30+ return new List < string >
31+ {
32+ "API log endpoint erişilemedi (404 veya bağlantı hatası)."
33+ } ;
34+ }
2135 }
2236
2337 public class LogEntryDto
Original file line number Diff line number Diff line change 2626app . UseHttpsRedirection ( ) ;
2727app . UseAuthorization ( ) ;
2828
29- // ✅ API v1 route group
30- var v1 = app . MapGroup ( "/api/v1" ) ;
31-
32- v1 . MapControllers ( ) ;
33- v1 . MapHealthChecks ( "/health" ) ;
34-
35- // ✅ ROOT health endpoint (Render ve dış sistemler için ZORUNLU)
36- app . MapHealthChecks ( "/health" ) ;
29+ // ✅ KRİTİK DÜZELTME — GROUP KULLANMIYORUZ
30+ app . MapControllers ( ) ; // /api/v1/logs artık %100 çalışacak
31+ app . MapHealthChecks ( "/api/v1/health" ) ; // versiyonlu health
32+ app . MapHealthChecks ( "/health" ) ; // root health (Render için)
3733
3834app . Run ( ) ;
You can’t perform that action at this time.
0 commit comments