Files
RpgRoller/RpgRoller/Program.cs

33 lines
977 B
C#

using RpgRoller.Api;
using RpgRoller.Components;
using RpgRoller.Hosting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRpgRollerCore(builder.Configuration, builder.Environment);
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddScoped<RpgRollerApiClient>();
var app = builder.Build();
app.InitializeRpgRollerState();
var configuredPathBase = builder.Configuration["PathBase"];
if (!string.IsNullOrWhiteSpace(configuredPathBase))
{
var normalizedPathBase = configuredPathBase.Trim();
if (!normalizedPathBase.StartsWith('/'))
normalizedPathBase = $"/{normalizedPathBase}";
normalizedPathBase = normalizedPathBase.TrimEnd('/');
if (normalizedPathBase.Length > 0)
app.UsePathBase(normalizedPathBase);
}
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRpgRollerApi();
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
app.Run();
public partial class Program;