chore: 初始化项目基础文件

This commit is contained in:
2025-11-22 21:27:38 +08:00
parent b587e8c1e1
commit ddf584f212
49 changed files with 6629 additions and 15 deletions

View File

@@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromMemory(new()
{
Clusters =
{
["admin"] = new()
{
Destinations = { ["d1"] = new() { Address = "http://localhost:5001/" } }
},
["mini"] = new()
{
Destinations = { ["d1"] = new() { Address = "http://localhost:5002/" } }
},
["user"] = new()
{
Destinations = { ["d1"] = new() { Address = "http://localhost:5003/" } }
}
},
Routes =
{
new()
{
RouteId = "admin-route",
ClusterId = "admin",
Match = new() { Path = "/api/admin/{**catch-all}" }
},
new()
{
RouteId = "mini-route",
ClusterId = "mini",
Match = new() { Path = "/api/mini/{**catch-all}" }
},
new()
{
RouteId = "user-route",
ClusterId = "user",
Match = new() { Path = "/api/user/{**catch-all}" }
}
}
});
var app = builder.Build();
app.MapReverseProxy();
app.Run();