we can use IStartupFilter to Configure http pipline for modules design #107
Closed
1257960069
started this conversation in
Ideas
Replies: 1 comment
-
Thanks for highlighting this, I didn't know there was a way to customize the Web Application which is what was needed to move OpenAPI v3 configuration to Configure.OpenApi.cs which I've just applied to all our Identity Auth .NET 8 templates. public class ConfigureOpenApi : IHostingStartup
{
public void Configure(IWebHostBuilder builder) => builder
.ConfigureServices((context, services) =>
{
if (context.HostingEnvironment.IsDevelopment())
{
services.AddEndpointsApiExplorer();
services.AddSwaggerGen();
services.AddServiceStackSwagger();
services.AddBasicAuth<Data.ApplicationUser>();
//services.AddJwtAuth();
services.AddTransient<IStartupFilter, StartupFilter>();
}
});
public class StartupFilter : IStartupFilter
{
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next) => app =>
{
app.UseSwagger();
app.UseSwaggerUI();
next(app);
};
}
} I've also added an example of this to Modular Startup Docs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions