public static void UseRouting(this ServerOptions app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.UseMiddleware(new EndpointRoutingMiddleware()); }
public static void UseMvc(this ServerOptions app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.UseMiddleware(new ControllerMiddleware()); }
/// <summary> /// Captures <see cref="Exception"/> instances from the pipeline and generates error responses. /// </summary> /// <param name="app">The <see cref="ServerOptions"/> instance this method extends.</param> public static void UseDeveloperExceptionPage(this ServerOptions app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.UseMiddleware(new DeveloperExceptionPageMiddleware()); }
public static void UseCustomMiddleware(this ServerOptions option) { if (option == null) { throw new ArgumentNullException(nameof(option)); } option.UseMiddleware(new CustomMiddleware()); }
/// <summary> /// Status code middleware with the given options that checks for responses with status codes /// between 400 and 599 that do not have a body. /// </summary> /// <param name="app">The <see cref="ServerOptions"/> instance this method extends.</param> public static void UseStatusCodePages(this ServerOptions app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.UseMiddleware(new StatusCodePagesMiddleware()); }
/// <summary> /// Enables static file serving for the current request path. /// </summary> /// <param name="server">The <see cref="ServerOptions"/> instance this method extends.</param> public static void UseDefaultFiles(this ServerOptions server) { if (server == null) { throw new ArgumentNullException(nameof(server)); } server.UseMiddleware(new DefaultFilesMiddleware()); }
/// <summary> /// Enables static file serving for the current request path. /// </summary> /// <param name="options">The <see cref="ServerOptions"/> instance this method extends.</param> public static void UseStaticFiles(this ServerOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } options.UseMiddleware(new StaticFileMiddleware()); }
/// <summary> /// Enables resource file serving for the current request path. /// </summary> /// <param name="app">The <see cref="ServerOptions"/> instance this method extends.</param> /// <param name="options">The <see cref="ResourceFileOptions"/> used to configure the middleware.</param> public static void UseResourceFiles(this ServerOptions app, ResourceFileOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } app.UseMiddleware(new ResourceFileMiddleware(options)); }
/// <summary> /// Enable authentication capabilities. /// </summary> /// <param name="app">The <see cref="ServerOptions"/> instance this method extends.</param> /// <param name="options">The <see cref="AuthenticationOptions"/> used to configure the middleware.</param> public static void UseAuthentication(this ServerOptions app, AuthenticationOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } app.UseMiddleware(new AuthenticationMiddleware(options)); }
public static void UseEndpoints(this ServerOptions app, EndpointRouteAction configure) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } //var endpointRouteBuilder = new EndpointRouteBuilder(); //configure(endpointRouteBuilder); //var routes = (ArrayList)endpointRouteBuilder.DataSources; app.UseMiddleware(new EndpointMiddleware()); }