-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (30 loc) · 1021 Bytes
/
Copy pathProgram.cs
File metadata and controls
39 lines (30 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var builder = WebApplication.CreateBuilder(args);
// If you want swagger for the Scourge endpoints (Not needed if you know the endpoints :D)
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// Add Scourge Services
builder.Services.AddScourge();
var app = builder.Build();
// Map scourge
app.MapScourge("/");
// If you want swagger (Not needed if you know the endpoints :D)
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
// AppDomains does not exist in .net core...but some compatibility was left behind :D
AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
{
// The throw in async void at least gets here :D
Console.WriteLine($"[Unhandled (IsTerminating: {eventArgs.IsTerminating})]: {eventArgs.ExceptionObject}");
};
try
{
app.Run();
}
catch (Exception e)
{
// No, stack overflow will never end here, it's not possible to catch a stack overflow exception like this.
Console.WriteLine($"[FATAL]: {e}");
}