-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (35 loc) · 1.18 KB
/
Program.cs
File metadata and controls
53 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using WebGameApi.Models;
using WebGameApi.Services;
using Microsoft.Extensions.FileProviders;
var builder = WebApplication.CreateBuilder(args);
builder.Services.Configure<WebGameDBSettings>(
builder.Configuration.GetSection("MongoDB"));
builder.Services.AddSingleton<AccountService>();
builder.Services.AddSingleton<RecordService>();
builder.Services.AddSingleton<SavesService>();
builder.Services.AddSingleton<UpgradesService>();
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
//PhysicalFileProvider fileProvider = new PhysicalFileProvider(
//Path.Combine(Directory.GetCurrentDirectory(), @"game"));
DefaultFilesOptions defoptions = new DefaultFilesOptions();
defoptions.DefaultFileNames.Clear();
//defoptions.FileProvider = fileProvider;
defoptions.DefaultFileNames.Add("index.html");
app.UseDefaultFiles(defoptions);
app.UseStaticFiles();
/*
app.UseStaticFiles(new StaticFileOptions()
{
//FileProvider = fileProvider,
RequestPath = new PathString("")
});
*/
app.Run();