예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("CorsPolicy");
            }

            seed.SeedData(20, 1000);

            app.UseMvc(routes => routes.MapRoute(
                           "default", "api/{contoller}/{action}/{id?}"
                           ));

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("CorsPolicy");
            }

            /*else
             * {
             *  app.UseExceptionHandler("/Error");
             *  app.UseHsts();
             * }*/

            seed.SeedData(20, 1000);

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

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

                /* endpoints.MapControllerRoute(
                 * name: "default",
                 * pattern: "api/{controller}/{action}/{id?}",
                 * defaults: new { controller = "Home", action = "Index" });
                 */
            });
        }
예제 #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, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

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

            var nCustomers = 20;
            var nOrders    = 1000;

            seed.SeedData(nCustomers, nOrders);

            app.UseEndpoints(routes => routes.MapControllerRoute(
                                 "default", "api/{controller}/{action}/{id?}"
                                 ));
        }
예제 #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        // IWebHostEnvironment
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("CorsPolicy");
            }

            seed.SeedData(20, 1000);
            app.UseMvc(routes => routes.MapRoute(
                           "default", "api/{controller}/{action}/{id?}"
                           ));
        }
예제 #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            seed.SeedData(20, 1000);
            app.UseHttpsRedirection();
            app.UseCors("AllowMyOrigin").UseMvc();
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DataSeed seeder)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("CorsPolicy");
            var nCustomers = 20;
            var nOrders    = 1000;

            seeder.SeedData(nCustomers, nOrders);

            app.UseMvc(routes =>
                       routes.MapRoute("default", "api/{controller}/{action}/{id?}")
                       );
        }
예제 #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            //seed.SeedData(5, 20);

            app.UseHttpsRedirection();
            app.UseMvc(routes => routes.MapRoute(
                           "default", "api/{controller}/{action}/{id?}"
                           ));
        }
예제 #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("CorsPolicy");
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            seed.SeedData(20, 1000);
            app.UseMvc(routes => routes.MapRoute(
                           "default", "api/{controller}/{action}/{id?}"
                           ));
        }
예제 #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            seed.SeedData(20, 1000);

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #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, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseCors("CorsPolicy");
            app.UseHttpsRedirection();
            app.UseRouting();
            seed.SeedData(20, 1000);


            //  linie dotyczace zapisywania plikow

            app.UseStaticFiles();
            app.UseStaticFiles(new StaticFileOptions());
            // {
            //    FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"Resources")),
            //     RequestPath = new PathString("/Resources")
            // });



            // koniec linii

            // Autoryzacje zabawa
            app.UseAuthentication();
            app.UseAuthorization();
            // Autoryzacje zabawa - koniec
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });


            app.UseOpenApi();
            app.UseSwaggerUi3();
        }
예제 #11
0
        //This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataSeed seed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                #region Check connection string

                //Check if there's a connection string.
                //var result = string.IsNullOrEmpty(connectionString) ? "Null" : "Not Null";

                //app.Run(async (context) =>
                //{
                //    await context.Response.WriteAsync($"Secret is {result}");
                //});

                #endregion

                //Add Cors policy.
                app.UseCors("CorsPolicy");
            }
            else
            {
                app.UseHsts();
            }

            app.UseCors("CorsPolicy");

            //Seed the database.
            seed.SeedData(NumberOfCustomers, NumberOfOrders);

            //app.UseHttpsRedirection();

            app.UseMvc(routes => routes.MapRoute(
                           "default", "api/{controller}/{action}/{id?}"
                           ));
        }