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