diff options
Diffstat (limited to 'SystemdCtl/Program.cs')
-rw-r--r-- | SystemdCtl/Program.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/SystemdCtl/Program.cs b/SystemdCtl/Program.cs new file mode 100644 index 0000000..c399d31 --- /dev/null +++ b/SystemdCtl/Program.cs @@ -0,0 +1,38 @@ +using SystemdCtl.Client.Pages; +using SystemdCtl.Components; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddRazorComponents() + .AddInteractiveServerComponents() + .AddInteractiveWebAssemblyComponents(); +builder.Services.AddControllers().AddJsonOptions(options => +{ + options.JsonSerializerOptions.WriteIndented = true; + options.JsonSerializerOptions.DefaultBufferSize = 128; +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseWebAssemblyDebugging(); +} +else +{ + app.UseExceptionHandler("/Error", createScopeForErrors: true); +} + +app.UseStaticFiles(); +app.UseRouting(); +app.UseAntiforgery(); +app.MapControllers(); + +app.MapRazorComponents<App>() + .AddInteractiveServerRenderMode() + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(Services).Assembly); + +app.Run(); |