Newer
Older
Undo / BlazorClient / Program.cs
@Derek Comartin Derek Comartin on 28 Mar 2023 1 KB Init
using BlazorClient;
using BlazorClient.Data;
using UndoExample;

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseNServiceBus(_ =>
{
    var endpointConfiguration = new EndpointConfiguration("Demo");
    var transport = endpointConfiguration.UseTransport<LearningTransport>();
    endpointConfiguration.UsePersistence<LearningPersistence>();

    var routing = transport.Routing();
    routing.RouteToEndpoint(
        assembly: typeof(Tweet).Assembly,
        destination: "Demo");

    return endpointConfiguration;
});

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddTransient<UndoTweetPolicy>();
builder.Services.AddTransient<TweetHandler>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapHub<TweetHub>("/tweethub");
app.MapFallbackToPage("/_Host");

app.Run();