UseTraxDashboard

Maps the Trax.Core Dashboard Blazor components at the configured route prefix. Call this after app.Build() during application startup.

Signature

public static WebApplication UseTraxDashboard(
    this WebApplication app,
    string routePrefix = "/trax",
    string? title = null
)

Parameters

ParameterTypeRequiredDefaultDescription
routePrefixstringNo"/trax"URL prefix where the dashboard is mounted. Leading/trailing slashes are normalized.
titlestring?NonullOverrides the dashboard title. null keeps the title from DashboardOptions.

Returns

WebApplication — for continued middleware chaining.

Example

var app = builder.Build();
 
app.UseTraxDashboard(
    routePrefix: "/admin/trains",
    title: "Order Processing Dashboard");
 
app.Run();

The dashboard will be accessible at https://yourapp/admin/trains.

What It Configures

  1. UseStaticFiles() — serves static assets (CSS, JS)
  2. UseAntiforgery() — CSRF protection for Blazor forms
  3. MapStaticAssets() — maps static web assets from the dashboard RCL
  4. MapRazorComponents<App>().AddInteractiveServerRenderMode() — maps Blazor components with Interactive Server rendering

Remarks

  • Must be called after builder.Build() and before app.Run().
  • The routePrefix is normalized: "trax", "/trax", and "/trax/" all resolve to "/trax".
  • The dashboard requires a data provider (UsePostgres or UseInMemory) to be configured for metadata and manifest pages to function.