- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
23 lines (20 loc) · 585 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
varbuilder=WebApplication.CreateBuilder(args);
builder.Services.AddOutputCache();
varapp=builder.Build();
app.MapGet("/",()=>
{
returnResults.Content("""
<html>
<body>
<ul>
<li><a href="/now">DateTime.UtcNow()</a></li>
<li><a href="/cached-now">DateTime.UtcNow() cached</a></li>
</ul>
</body>
</html>
""","text/html");
});
app.UseOutputCache();
app.MapGet("/now",()=>DateTime.UtcNow.ToString());
app.MapGet("/cached-now",()=>DateTime.UtcNow.ToString()).CacheOutput();
app.Run();