From 3812a46e2f85602392b7620dd9085d9875e444ca Mon Sep 17 00:00:00 2001 From: ArgonarioD Date: Thu, 6 Jul 2023 11:34:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BAfiles=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E9=9D=99=E6=80=81=E6=96=87=E4=BB=B6=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AicsKnowledgeBase_file/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AicsKnowledgeBase_file/Program.cs b/AicsKnowledgeBase_file/Program.cs index 5d1f756..a6a1f4b 100644 --- a/AicsKnowledgeBase_file/Program.cs +++ b/AicsKnowledgeBase_file/Program.cs @@ -2,6 +2,7 @@ using System.Text.Json; using AicsKnowledgeBase_file.Handlers; using AicsKnowledgeBase_file.Models; using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.FileProviders; Directory.CreateDirectory("./files"); @@ -41,6 +42,11 @@ if (app.Environment.IsDevelopment()) { app.MapGet("/hello", () => "hello"); +app.UseStaticFiles(new StaticFileOptions { + FileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath, "files")), + RequestPath = "/static" +}); + app.UseHttpsRedirection(); app.MapControllers();