Exemplo n.º 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, ILoggerManager logger)
        {
            app.UseProblemDetails();

            ////TODO: remove after testing
            //app.UseDeveloperExceptionPage();

            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //}
            //else
            //{
            //    // added from book, what is that ?
            //    app.UseHsts();
            //}

            ServiceExtensions.UpdateDatabase(app);

            //TODO: remove after testing
            //app.ConfigureExceptionHandler(logger);

            app.UseHttpsRedirection();

            // enables using static files for the request. If we don’t set a path to the static files directory, it will use a wwwroot folder in our project by default.
            app.UseStaticFiles();

            app.UseCors("CorsPolicy");

            // will forward proxy headers to the current request. This will help us during application deployment.
            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.All
            });

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

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