1
0
Blazor_Canvas/BlazorCanvas/BlazorCanvas.Server/Program.cs

40 lines
1010 B
C#
Raw Permalink Normal View History

using BlazorCanvas.Server.Components;
using BlazorCanvas.Server.Components.Data;
2023-11-15 12:32:30 -05:00
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Hosting;
2023-11-11 15:43:52 -05:00
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
2023-11-11 15:43:52 -05:00
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
2023-11-16 06:46:31 -05:00
builder.AddRedis("cache");
2023-11-16 06:46:31 -05:00
builder.Services.AddTransient<IRedisService, RedisService>();
builder.Services.AddTransient<CanvasService>();
2023-11-11 15:43:52 -05:00
var app = builder.Build();
app.MapDefaultEndpoints();
2023-11-11 15:43:52 -05:00
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
2023-11-11 15:43:52 -05:00
// 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.UseAntiforgery();
2023-11-11 15:43:52 -05:00
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
2023-11-11 15:43:52 -05:00
app.Run();