public static IApplicationBuilder UseGraphQLPlayground(this IApplicationBuilder app, GraphQLPlaygroundOptions options)
        {
            if (options == null)
            {
                options = new GraphQLPlaygroundOptions();
            }

            app.UseMiddleware <PlaygroundMiddleware>(options);
            return(app);
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new PlaygroundMiddleware
 /// </summary>
 /// <param name="nextMiddleware">The Next Middleware</param>
 /// <param name="settings">The Settings of the Middleware</param>
 public PlaygroundMiddleware(RequestDelegate nextMiddleware, GraphQLPlaygroundOptions settings)
 {
     this.nextMiddleware = nextMiddleware ?? throw new ArgumentNullException(nameof(nextMiddleware));
     this.settings       = settings ?? throw new ArgumentNullException(nameof(settings));
 }
        public static IApplicationBuilder UseGraphQLPlayground(this IApplicationBuilder app, GraphQLPlaygroundOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            app.UseMiddleware <PlaygroundMiddleware>(options);
            return(app);
        }
Esempio n. 4
0
 /// <summary>
 /// Create a new <see cref="PlaygroundMiddleware"/>
 /// </summary>
 /// <param name="nextMiddleware">The next middleware</param>
 /// <param name="options">Options to customize middleware</param>
 public PlaygroundMiddleware(RequestDelegate nextMiddleware, GraphQLPlaygroundOptions options)
 {
     _nextMiddleware = nextMiddleware ?? throw new ArgumentNullException(nameof(nextMiddleware));
     _options        = options ?? throw new ArgumentNullException(nameof(options));
 }
Esempio n. 5
0
        public static IApplicationBuilder UseGraphQLPlayground(this IApplicationBuilder app, GraphQLPlaygroundOptions options)
        {
            app.UseFileServer(new FileServerOptions()
            {
                RequestPath  = new PathString(options.Path),
                FileProvider = new EmbeddedFileProvider(
                    typeof(PlaygroundExtensions).GetTypeInfo().Assembly,
                    "GraphQL.Server.Ui.Playground.Html")
            });

            return(app);
        }