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

38 lines
944 B
C#
Raw 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();
builder.AddRedis("cache");
2023-11-12 08:15:22 -05:00
builder.Services.AddScoped<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();