mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 22:17:22 +01:00
add static file serving
This commit is contained in:
parent
8f391c6afb
commit
8a3adf9c07
1 changed files with 10 additions and 0 deletions
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue