Program.cs 954 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using goods.Models;
  2. using Microsoft.EntityFrameworkCore;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Add services to the container.
  5. builder.Services.AddControllersWithViews();
  6. // DB ¿¬°á
  7. builder.Services.AddDbContext<DBContext>(options =>
  8. options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
  9. // HttpClient »ç¿ë
  10. builder.Services.AddHttpClient<CoupangPartners>();
  11. var app = builder.Build();
  12. // Configure the HTTP request pipeline.
  13. if (!app.Environment.IsDevelopment())
  14. {
  15. app.UseExceptionHandler("/Home/Error");
  16. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  17. app.UseHsts();
  18. }
  19. app.UseHttpsRedirection();
  20. app.UseStaticFiles();
  21. app.UsePathBase("/goods");
  22. app.UseRouting();
  23. app.UseAuthorization();
  24. app.MapControllerRoute(
  25. name: "default",
  26. pattern: "{controller=Home}/{action=Index}/{id?}");
  27. app.Run();