49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using EnvelopeGenerator.Web.Handler;
|
|
using EnvelopeGenerator.Web.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add basic blazor services to the container.
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddServerSideBlazor();
|
|
|
|
// Add custom services
|
|
builder.Services.AddSingleton<LoggingService>();
|
|
builder.Services.AddTransient<DatabaseService>();
|
|
|
|
builder.Services.AddLocalization();
|
|
|
|
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();
|
|
}
|
|
|
|
// Redirect http:// to https://
|
|
//app.UseHttpsRedirection();
|
|
|
|
// Serve static assets like css
|
|
app.UseStaticFiles();
|
|
|
|
// Add a router
|
|
app.UseRouting();
|
|
|
|
// Add file download endpoint
|
|
app.MapGet("/api/document/{envelopeKey}", FileHandler.HandleFileDownload);
|
|
app.MapPost("/api/document/{envelopeKey}/{documentId}", FileHandler.HandleFileUpload);
|
|
app.MapGet("/api/envelope/{envelopeKey}", FileHandler.HandleGetData);
|
|
app.MapPost("/api/envelope/{envelopeKey}/{documentId}", FileHandler.HandlePostData);
|
|
|
|
// Blazor plumbing
|
|
app.MapBlazorHub();
|
|
app.MapFallbackToPage("/_Host");
|
|
|
|
// Get crackin'!
|
|
app.Run();
|