- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
29 lines (24 loc) · 839 Bytes
/
Program.cs
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
varbuilder=WebApplication.CreateBuilder();
builder.Services.AddProblemDetails(options =>options.CustomizeProblemDetails= ctx =>
{
ctx.ProblemDetails.Extensions.Add("custom-property",Guid.NewGuid().ToString());
});
varapp=builder.Build();
app.UseExceptionHandler();
app.MapGet("/",(HttpContextcontext)=>Results.Content($$"""
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
</head>
<body>
<div class="container">
<a href="/problems">Show problems</a>
</div>
</body>
</html>
""","text/html"));
app.MapGet("/problems",(HttpContextcontext)=>
{
thrownewApplicationException("We got problems");
});
app.Run();