20 lines
585 B
C#
20 lines
585 B
C#
|
|
using Microsoft.AspNetCore.Builder;
|
||
|
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
using Microsoft.Extensions.Hosting;
|
||
|
|
using Microsoft.Extensions.FileProviders;
|
||
|
|
|
||
|
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
|
||
|
|
var app = builder.Build();
|
||
|
|
|
||
|
|
// Configure static files to serve from current directory
|
||
|
|
app.UseStaticFiles(new StaticFileOptions
|
||
|
|
{
|
||
|
|
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
|
||
|
|
RequestPath = ""
|
||
|
|
});
|
||
|
|
|
||
|
|
// Fallback to index.html for SPA routing
|
||
|
|
app.MapFallbackToFile("index.html");
|
||
|
|
|
||
|
|
app.Run("http://localhost:8000");
|