using FastGithub.HttpServer; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; namespace FastGithub { /// /// ApplicationBuilder扩展 /// public static class ApplicationBuilderExtensions { /// /// 使用http代理中间件 /// /// /// public static IApplicationBuilder UseHttpProxy(this IApplicationBuilder app) { var middleware = app.ApplicationServices.GetRequiredService(); return app.Use(next => context => middleware.InvokeAsync(context)); } /// /// 使用请求日志中间件 /// /// /// public static IApplicationBuilder UseRequestLogging(this IApplicationBuilder app) { var middleware = app.ApplicationServices.GetRequiredService(); return app.Use(next => context => middleware.InvokeAsync(context, next)); } /// /// 使用反向代理中间件 /// /// /// public static IApplicationBuilder UseHttpReverseProxy(this IApplicationBuilder app) { var middleware = app.ApplicationServices.GetRequiredService(); return app.Use(next => context => middleware.InvokeAsync(context, next)); } } }