First commit

This commit is contained in:
2026-04-30 09:10:43 -05:00
commit fc41889a4b
9 changed files with 703 additions and 0 deletions

49
Program.cs Normal file
View File

@@ -0,0 +1,49 @@
using System.Net;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
//my reverse proxy handles HTTPS
//app.UseHttpsRedirection();
app.MapGet("/{name}", async (string name) =>
{
string? url = await Redirect.HandleRedirectAsync(name);
if(url is not null)
return Results.Redirect(url,false,false);
else
return Results.Text(
"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="dark light">
<title>Not Found</title>
</head>
<body>
<h1>Not Found</h1>
</body>
</html>
"""
,"text/html",System.Text.Encoding.UTF8,404);
})
.WithName("Redirect");
app.Run();