Beispiel #1
0
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground();
     //app.UseGraphQLPlayground(new PlaygroundOptions());
     dbContext.Seed();
 }
Beispiel #2
0
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     //app.MVC() is not needed here. Activate to activate both Controller support( REST) and GraphQL
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
     dbContext.Seed();
 }
        public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
        {
            var graphqlEndpoint = "/graphql";

            app.UseCors(builder => {
                builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
            });

            app.UseWebSockets();
            app.UseGraphQLWebSockets <CarvedRockSchema>(graphqlEndpoint);
            app.UseGraphQL <CarvedRockSchema>(graphqlEndpoint);
            app.UseGraphiQLServer(new GraphiQLOptions
            {
                GraphiQLPath    = "/graphiql",
                GraphQLEndPoint = graphqlEndpoint
            });
            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions {
                Path            = "/playground",
                GraphQLEndPoint = graphqlEndpoint
            });
            app.UseGraphQLVoyager(new GraphQLVoyagerOptions()
            {
                Path            = "/voyager",
                GraphQLEndPoint = graphqlEndpoint
            });

            // dbContext.Seed();
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CarvedRockDbContext dbContext)
        {
            dbContext.Seed();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                //app.UseSwagger();
                //app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "CarvedRock.Api v1"));
            }

            // add http for Schema at default url /graphql
            app.UseGraphQL <ISchema>();

            // use graphql-playground at default url /ui/playground
            app.UseGraphQLPlayground();

            //app.UseHttpsRedirection();

            //app.UseRouting();

            //app.UseAuthorization();

            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapControllers();
            //});
        }
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     app.UseWebSockets();
     app.UseGraphQLWebSockets <CarvedRockSchema>("/graphql");
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
     dbContext.Seed();
 }
Beispiel #6
0
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
     app.UseWebSockets();
     app.UseGraphQLWebSockets <CarvedRockSchema>();
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
     dbContext.Seed();
 }
        public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
        {
            app.UseGraphQL <CarvedRockSchema>();                      // In argument we can specify the endpoint URI, /GraphQl default

            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions()); // To play around with the API without web application ( web app not yet created )
                                                                      // Sets up the default GraphQL playground at /ui/Playground
                                                                      // Project properties -> Debug -> Launch browser -> ui/Playground (starts the browser with the playground)

            // Fill the database
            dbContext.Seed();
        }
Beispiel #8
0
        public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
        {
            app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); //povolenie any origin, neaplikovat na produkcii

            app.UseWebSockets();
            app.UseGraphQLWebSockets <CarvedRockSchema>("/graphql");  //pridanie graphql websockets endpointu do pipeliny

            app.UseGraphQL <CarvedRockSchema>();                      //pridanie GraphQL middlewaru --> ako parameter je mozne uviest ENDPOINT, ak nie je uvedeny tak bude /graphql
            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions()); //middleware pre GraphQL playground, options defaultne definuju playgroud dostupne na /ui/playground  a je ocakavane, ze GraphQL je na endpointe /graphql (default pre GraphQL middleware)
            dbContext.Seed();
        }
Beispiel #9
0
        public static void Main(string[] args)
        {
            IWebHost host = CreateWebHostBuilder(args).Build();

            using (IServiceScope scope = host.Services.CreateScope())
            {
                try
                {
                    CarvedRockDbContext context = scope.ServiceProvider.GetService <CarvedRockDbContext>();
                    context.Database.Migrate();
                }
                catch (Exception ex)
                {
                    ILogger logger = scope.ServiceProvider.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error ocurred while migrating the database.");
                }
            }

            host.Run();
        }
Beispiel #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CarvedRockDbContext dbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            dbContext.Seed();
        }
Beispiel #11
0
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     app.UseMvc();
     dbContext.Seed();
 }
Beispiel #12
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, CarvedRockDbContext dbContext)
 {
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
     dbContext.Seed();
 }