Нема описа

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Logger.API.Controllers;
  2. using Logger.Services;
  3. using Logger.Services.Interfaces;
  4. using Microsoft.AspNetCore.Builder;
  5. using Microsoft.AspNetCore.Hosting;
  6. using Microsoft.AspNetCore.Http;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Configuration;
  9. using Microsoft.Extensions.DependencyInjection;
  10. using Microsoft.Extensions.Hosting;
  11. using Microsoft.Extensions.Logging;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Linq;
  15. using System.Threading.Tasks;
  16. namespace Logger.API
  17. {
  18. public class Startup
  19. {
  20. public Startup(IConfiguration configuration)
  21. {
  22. Configuration = configuration;
  23. }
  24. public IConfiguration Configuration { get; }
  25. // This method gets called by the runtime. Use this method to add services to the container.
  26. public void ConfigureServices(IServiceCollection services)
  27. {
  28. services.AddControllers();
  29. services.AddScoped<IMonLogger, MonLogger>();
  30. services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
  31. }
  32. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  33. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  34. {
  35. if (env.IsDevelopment())
  36. {
  37. app.UseDeveloperExceptionPage();
  38. }
  39. app.UseMiddleware<LoggerServices>();
  40. app.UseRouting();
  41. app.UseAuthorization();
  42. app.UseEndpoints(endpoints =>
  43. {
  44. endpoints.MapControllers();
  45. });
  46. }
  47. }
  48. }

Powered by TurnKey Linux.