/// <summary> /// Create a new <see cref="VoyagerMiddleware"/> /// </summary> /// <param name="nextMiddleware">The next middleware</param> /// <param name="hostingEnv">Provides information about the web hosting environment an application is running in</param> /// <param name="loggerFactory">Represents a type used to configure the logging system and create instances of <see cref="ILogger"/> from the registered <see cref="ILoggerProvider"/></param> /// <param name="options">Options to customize middleware</param> public VoyagerMiddleware(RequestDelegate nextMiddleware, IWebHostEnvironment hostingEnv, ILoggerFactory loggerFactory, GraphQLVoyagerOptions options) { if (nextMiddleware == null) { throw new ArgumentNullException(nameof(nextMiddleware)); } _options = options ?? throw new ArgumentNullException(nameof(options)); _staticFileMiddleware = CreateStaticFileMiddleware(nextMiddleware, hostingEnv, loggerFactory); }
public static IApplicationBuilder UseGraphQLVoyager(this IApplicationBuilder app, GraphQLVoyagerOptions options) { if (options == null) { options = new GraphQLVoyagerOptions(); } app.UseMiddleware <VoyagerMiddleware>(options); return(app); }
/// <summary> /// Create a new VoyagerMiddleware /// </summary> /// <param name="nextMiddleware">The Next Middleware</param> /// <param name="settings">The Settings of the Middleware</param> public VoyagerMiddleware(RequestDelegate nextMiddleware, GraphQLVoyagerOptions settings) { this.nextMiddleware = nextMiddleware ?? throw new ArgumentNullException(nameof(nextMiddleware)); this._settings = settings ?? throw new ArgumentNullException(nameof(settings)); }
/// <summary> /// Create a new <see cref="VoyagerMiddleware"/> /// </summary> /// <param name="nextMiddleware">The next middleware</param> /// <param name="options">Options to customize middleware</param> public VoyagerMiddleware(RequestDelegate nextMiddleware, GraphQLVoyagerOptions options) { _nextMiddleware = nextMiddleware ?? throw new ArgumentNullException(nameof(nextMiddleware)); _options = options ?? throw new ArgumentNullException(nameof(options)); }