add static file serving
This commit is contained in:
@@ -14,6 +14,8 @@ using Microsoft.AspNetCore.Http.Connections;
|
|||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using Prometheus;
|
using Prometheus;
|
||||||
using WebSocketOptions = Microsoft.AspNetCore.Builder.WebSocketOptions;
|
using WebSocketOptions = Microsoft.AspNetCore.Builder.WebSocketOptions;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MareSynchronosServer
|
namespace MareSynchronosServer
|
||||||
{
|
{
|
||||||
@@ -78,6 +80,7 @@ namespace MareSynchronosServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
app.UseHttpLogging();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
var webSocketOptions = new WebSocketOptions
|
var webSocketOptions = new WebSocketOptions
|
||||||
@@ -85,6 +88,13 @@ namespace MareSynchronosServer
|
|||||||
KeepAliveInterval = TimeSpan.FromSeconds(10),
|
KeepAliveInterval = TimeSpan.FromSeconds(10),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
app.UseStaticFiles(new StaticFileOptions()
|
||||||
|
{
|
||||||
|
FileProvider = new PhysicalFileProvider(Configuration["CacheDirectory"]),
|
||||||
|
RequestPath = "/cache",
|
||||||
|
ServeUnknownFileTypes = true
|
||||||
|
});
|
||||||
|
|
||||||
app.UseHttpMetrics();
|
app.UseHttpMetrics();
|
||||||
app.UseWebSockets(webSocketOptions);
|
app.UseWebSockets(webSocketOptions);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user