// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <PersistenceDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddControllers(); services.AddMvc().AddRazorPagesOptions(options => { options.Conventions.AddPageRoute("/swagger", "/swagger"); }); //injeção de dependência do microserviço AddStartup.AddProductDependencyInjection(services); AddStartup.AddSwaggerAndDependencies(services, "Products Service", "v1", "Products Service for usage example of architecture", Configuration); AddSecurity.AddBearerTokens(services); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); // Ativando middlewares para uso do Swagger AddStartup.AddSwaggerAndSecurityToApp(app); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }