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 //publish need to take comment out
services.AddSwaggerGen(c => services.AddSwaggerGen();
{
// c.ResolveConflictingActions(api => api.First());
c.SwaggerDoc("v1", new OpenApiInfo { Title = "CarParkValidationAPI", Version = "v1" });
});
/* /*
services.AddSwaggerGen(option => services.AddSwaggerGen(option =>
{ {
@@ -109,11 +106,7 @@ namespace CarParkValidationAPI
app.UseMiddleware<ErrorHandlerMiddleware>(); // use this exception app.UseMiddleware<ErrorHandlerMiddleware>(); // use this exception
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => app.UseSwaggerUI();
{
c.DocExpansion(Swashbuckle.AspNetCore.SwaggerUI.DocExpansion.None);
c.SwaggerEndpoint("/swagger/v1/swagger.json", "CarParkValidationAPI v1");
});
app.UseRouting(); app.UseRouting();
@@ -134,16 +127,12 @@ namespace CarParkValidationAPI
app.UseAuthorization(); 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 => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); endpoints.MapControllers();
// endpoints.MapFallbackToController("Index", "Fallback"); //<------------------ put angular in wwwroot.
}); });
} }