50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using DigitalData.Modules.Logging;
|
|
using EnvelopeGenerator.Common;
|
|
using EnvelopeGenerator.Web.Services;
|
|
using Quartz;
|
|
|
|
namespace EnvelopeGenerator.Web
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add base services
|
|
builder.Services.AddSingleton<LoggingService>();
|
|
builder.Services.AddTransient<DatabaseService>();
|
|
|
|
// Add higher order services
|
|
builder.Services.AddSingleton<EnvelopeService>();
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews().AddJsonOptions(q =>
|
|
{
|
|
// Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver
|
|
q.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
// 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.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
} |