remove hard code swagger version

This commit is contained in:
Kham
2025-11-10 12:12:01 +11:00
parent e318260acd
commit f693e70d10
+6 -17
View File
@@ -66,15 +66,12 @@ namespace CarParkValidationAPI
};
});
// services.AddAutoMapper(typeof(Startup));
// services.AddAutoMapper(typeof(Startup));
//**
//publish need to take comment out
services.AddSwaggerGen(c =>
{
// c.ResolveConflictingActions(api => api.First());
c.SwaggerDoc("v1", new OpenApiInfo { Title = "CarParkValidationAPI", Version = "v1" });
});
services.AddSwaggerGen();
/*
services.AddSwaggerGen(option =>
{
@@ -109,11 +106,7 @@ namespace CarParkValidationAPI
app.UseMiddleware<ErrorHandlerMiddleware>(); // use this exception
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.DocExpansion(Swashbuckle.AspNetCore.SwaggerUI.DocExpansion.None);
c.SwaggerEndpoint("/swagger/v1/swagger.json", "CarParkValidationAPI v1");
});
app.UseSwaggerUI();
app.UseRouting();
@@ -134,16 +127,12 @@ namespace CarParkValidationAPI
app.UseAuthorization();
/* if add angular under wwwroot then two line below needed*/
/***************************/
// app.UseDefaultFiles(); //it will use index.html <------------------
// app.UseStaticFiles(); //it for angular <-------------------------
/***************************/
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
// endpoints.MapFallbackToController("Index", "Fallback"); //<------------------ put angular in wwwroot.
});
}