// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DbSeedData seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // use https connection app.UseHttpsRedirection(); app.UseRouting(); // use cors that is configured in ConfigureServices app.UseCors(MySpecificOrigin); // use authentication that is configured in ConfigureServices app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); // seed data for development use seeder.EnsureSeedData(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DbSeedData seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ticketsystem_backend v1")); } app.UseHttpsRedirection(); app.UseRouting(); app.UseCors(MySpecificOrigin); //app.UseCors(x => x // .AllowAnyMethod() // .AllowAnyHeader() // .SetIsOriginAllowed(origin => true) // .AllowCredentials()); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); //endpoints.MapGet("/echo", //context => context.Response.WriteAsync("echo")) //.RequireCors(MySpecificOrigin); //endpoints.MapControllers() // .RequireCors(MySpecificOrigin); //endpoints.MapGet("/echo2", // context => context.Response.WriteAsync("echo2")); //endpoints.MapRazorPages(); }); seeder.EnsureSeedData(); }