app.MapFallback("{*path:regex(^(?!api).*$)}", async context =>
{
var path = context.Request.Path;
string file;
if (path.StartsWithSegments("/management"))
{
file = Path.Combine(builder.Environment.WebRootPath, "management", "browser", "index.html");
}
else
{
file = Path.Combine(builder.Environment.WebRootPath, "vote", "browser", "index.html");
}
var html = await File.ReadAllTextAsync(file);
context.Response.ContentType = "text/html";
await context.Response.WriteAsync(html);
}).ShortCircuit();
app.MapFallback("{*path:regex(^(?!api).*$)}", async context =>
{
var path = context.Request.Path;
string file;
if (path.StartsWithSegments("/management"))
{
file = Path.Combine(builder.Environment.WebRootPath, "management", "browser", "index.html");
}
else
{
file = Path.Combine(builder.Environment.WebRootPath, "vote", "browser", "index.html");
}
var html = await File.ReadAllTextAsync(file);
context.Response.ContentType = "text/html";
await context.Response.WriteAsync(html);
}).ShortCircuit();