private static IAppBuilder UseGraphiQl(this IAppBuilder app, Func <GraphQlOptions, GraphQlOptions> config) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var assembly = typeof(GraphiQlExtensions).GetTypeInfo().Assembly; var path = "/graphql"; path = path.StartsWith("/") ? path : "/" + path; var graphQlOptions = new GraphQlOptions { Path = new PathString(path) }; var options = new FileServerOptions { EnableDefaultFiles = true, RequestPath = config(graphQlOptions).Path, FileSystem = new EmbeddedResourceFileSystem(assembly, "GraphiQL.assets"), StaticFileOptions = { ContentTypeProvider = new FileExtensionContentTypeProvider() }, }; app.UseFileServer(options); return(app); }
internal static GraphQlOptions Bootstrap(GraphQlOptions options) { return(new GraphiQlConfig(options).Options); }
private GraphiQlConfig(GraphQlOptions options) { Options = options; }