Esempio n. 1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserSeed userSeed, RoleSeed roleSeed, LevelSeed levelSeed, EnvironmentSeed environmentSeed, LogSeed logSeed, EventSeed eventSeed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                userSeed.Populate();
                roleSeed.Populate();
                levelSeed.Populate();
                environmentSeed.Populate();
                logSeed.Populate();
                eventSeed.Populate();
            }

            app.UseSwaggerSetup();

            app.UseHttpsRedirection();

            app.UseRouting();

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

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

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 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, UserSeed userSeed, LogLevelSeed levelSeed, EnvironmentSeed environmentSeed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                userSeed.Populate();
                levelSeed.Populate();
                environmentSeed.Populate();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

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

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

            app.UseSwagger();
            app.UseSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", "CadeOErro API"));
        }