swagger working /api/v1/swagger

This commit is contained in:
2025-10-21 19:15:16 +02:00
parent f207440ae6
commit 6eed3c764e

View File

@@ -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();