Blazor app with can interface
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using IOModuleTestBlazor;
|
|
|
|
|
using IOModuleTestBlazor.Components;
|
|
|
|
|
using IOModuleTestBlazor.Services;
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
|
|
// ── CAN bus ───────────────────────────────────────────────────────────────────
|
|
|
|
|
builder.Services.AddSingleton<ICanService, CanService>();
|
|
|
|
|
builder.Services.AddHostedService<CanWorker>();
|
|
|
|
|
|
|
|
|
|
// ── Serial port ───────────────────────────────────────────────────────────────
|
|
|
|
|
builder.Services.AddSingleton<ISerialPortService, SerialPortService>();
|
|
|
|
|
|
|
|
|
|
// ── Blazor ────────────────────────────────────────────────────────────────────
|
|
|
|
|
builder.Services.AddRazorComponents()
|
|
|
|
|
.AddInteractiveServerComponents();
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
|
|
|
app.UseHsts();
|
|
|
|
|
}
|
|
|
|
|
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
|
|
app.UseAntiforgery();
|
|
|
|
|
|
|
|
|
|
app.MapStaticAssets();
|
|
|
|
|
app.MapRazorComponents<App>()
|
|
|
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
|
|
|
|
|
|
app.Run();
|