// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ControleFinanceiroContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Pessoas}/{action=Index}/{id?}"); }); InicializaDB.Inicialize(context); }
public void Configure( IApplicationBuilder app, IHostingEnvironment env, DBContexto dbContexto) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseCors("MyCors"); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); InicializaDB.Initialize(dbContexto); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AgendamentoContexto contexto) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseCors( options => options.AllowAnyOrigin().AllowAnyMethod() ); app.UseCors(options => { options.WithOrigins("http://localhost") .AllowCredentials() .AllowAnyMethod() .AllowAnyHeader(); }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); InicializaDB.Initialize(contexto); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, AppDbContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } 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(); //app.UseGraphiQl(); app.UseMvc(); InicializaDB.Inicializa(context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Context context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Ativando middlewares para uso do Swagger app.UseSwagger(c => { c.RouteTemplate = "/docs/{documentName}/boticario.json"; }); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/docs/v1/boticario.json", "Boticário Cashback API - POC"); c.RoutePrefix = "docs"; //c.InjectStylesheet("/swagger-ui/custom.css"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); InicializaDB.Initialize(context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, EquipeContext e, ColaboradorContext c) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); InicializaDB.initializeEquipe(e); InicializaDB.initializeColaborador(c); }