From 6eed3c764e7470f0fb6fd8bdd62117ba5550a3ea Mon Sep 17 00:00:00 2001 From: triggermeelmo Date: Tue, 21 Oct 2025 19:15:16 +0200 Subject: [PATCH] swagger working /api/v1/swagger --- Watcher/Program.cs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Watcher/Program.cs b/Watcher/Program.cs index 9522004..466d1f1 100644 --- a/Watcher/Program.cs +++ b/Watcher/Program.cs @@ -211,31 +211,30 @@ using (var scope = app.Services.CreateScope()) if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } - app.UseHttpsRedirection(); +app.UseStaticFiles(); + app.UseRouting(); +// 🔹 Swagger aktivieren app.UseSwagger(); +app.UseSwaggerUI(options => +{ + options.SwaggerEndpoint("/swagger/v1/swagger.json", "Watcher-Server API v1"); + options.RoutePrefix = "api/v1/swagger"; +}); +// 🔹 Authentifizierung & Autorisierung app.UseAuthentication(); app.UseAuthorization(); -app.UseStaticFiles(); - +// 🔹 MVC-Routing app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}" - ); +); -app.MapSwagger(); - -app.UseSwaggerUI(options => -{ - options.SwaggerEndpoint("v1/swagger.json", "Watcher-Server API v1"); -}); - -app.Run(); \ No newline at end of file +app.Run();