Iloan.Rules/src/iLoan.Rules.Web/Program.cs

32 lines
1.2 KiB
C#
Raw Normal View History

2024-05-27 11:54:17 +00:00
using Radzen;
using ILoan.Rules.Web.Components;
2024-05-27 14:00:45 +00:00
using ILoan.Rules.Web.Services;
2024-05-27 11:59:51 +00:00
using Microsoft.EntityFrameworkCore;
2024-05-27 11:54:17 +00:00
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
2024-05-27 11:59:51 +00:00
builder.Services.AddRazorComponents().AddInteractiveServerComponents().AddHubOptions(options => options.MaximumReceiveMessageSize = 10 * 1024 * 1024);
2024-05-27 11:54:17 +00:00
builder.Services.AddControllers();
builder.Services.AddRadzenComponents();
builder.Services.AddHttpClient();
2024-05-27 11:59:51 +00:00
builder.Services.AddScoped<ILoan.Rules.Web.RulesService>();
2024-05-27 14:00:45 +00:00
builder.Services.AddScoped<RuleFileGeneratorService>();
2024-05-27 11:59:51 +00:00
builder.Services.AddDbContext<ILoan.Rules.Web.Data.RulesContext>(options =>
{
options.UseNpgsql(builder.Configuration.GetConnectionString("RulesConnection"));
});
2024-05-27 11:54:17 +00:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.MapControllers();
app.UseStaticFiles();
app.UseAntiforgery();
2024-05-27 11:59:51 +00:00
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
2024-05-27 11:54:17 +00:00
app.Run();