Program.cs 927 B

12345678910111213141516171819202122232425262728293031323334353637
  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.UseRouting();
  22. app.UseAuthorization();
  23. app.MapControllerRoute(
  24. name: "default",
  25. pattern: "{controller=Home}/{action=Index}/{id?}");
  26. app.Run();