Exemple #1
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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
            dbContext.Seed();
        }
Exemple #2
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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseGraphQL <CarvedRockSchema>();
            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
            //app.UseMvc();
            dbContext.Seed();
        }
Exemple #3
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();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            // GraphQL
            app.UseCors(builder =>
                        builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());

            app.UseGraphQL <CarvedRockSchema>();     // In argument we can specify the endpoint URI, /GraphQl default

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


            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseCookiePolicy();

            app.UseRouting();

            app.UseAuthorization();

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

            // Fill the database
            dbContext.Seed();
        }
Exemple #4
0
 public void Configure(IApplicationBuilder app, CarvedRockDbContext dbContext)
 {
     app.UseGraphQL <CarvedRockSchema>();
     app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
     dbContext.Seed();
 }