// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, IWorkshopPlanningRepository workshopPlanningRepo) { Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(_configuration) .CreateLogger(); app.UseMvc(); app.UseDefaultFiles(); app.UseStaticFiles(); AutomapperConfigurator.SetupAutoMapper(); // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "WorkshopManagement API - v1"); }); // register service in Consul app.RegisterWithConsul(lifetime); // initialize database workshopPlanningRepo.EnsureDatabase(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWorkshopPlanningRepository workshopPlanningRepo) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(_configuration) .Enrich.WithMachineName() .CreateLogger(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "WorkshopManagement API - v1"); }); // initialize database workshopPlanningRepo.EnsureDatabase(); }