Startup.cs 1.4 KB

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