Last active
February 13, 2023 22:34
-
-
Save neon-sunset/40edae0c10268440fcdb64d050afc1c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.StaticFiles.Infrastructure; | |
using Microsoft.Extensions.FileProviders; | |
var builder = WebApplication.CreateBuilder(args); | |
// builder.Logging.SetMinimumLevel(LogLevel.Warning); | |
builder.Services | |
.AddAntiforgery() | |
.AddResponseCompression(); | |
var host = builder.Build(); | |
var contentOptions = new SharedOptions | |
{ | |
FileProvider = new PhysicalFileProvider( | |
Path.Combine(host.Environment.ContentRootPath, "../web/dist/")) | |
}; | |
host.UseResponseCompression() | |
.UseDefaultFiles(new DefaultFilesOptions(contentOptions)) | |
.UseStaticFiles(new StaticFileOptions(contentOptions)); | |
host.Run("http://+:8080"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment