-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (36 loc) · 1.64 KB
/
Copy pathProgram.cs
File metadata and controls
39 lines (36 loc) · 1.64 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
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System.IO;
namespace ShoppingListServer
{
public class Program
{
public static void Main(string[] args)
{
// UseContentRoot: Use the current directory as root so that the wwwroot folder is a child. (not sure if it's necessary to call this)
CreateHostBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory())
.Build().Run();
}
// Uses the certificates specified in
// Calls Configure which sets up Kestrel, see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0
// "Kestrel" -> "Certificates" -> "Default"
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
config.AddJsonFile("auth/secrets.json", optional: true);
if (hostingContext.HostingEnvironment.IsDevelopment())
{
config.AddJsonFile("auth/devMode.json", optional: true);
config.AddJsonFile("auth/dev/credentials.json", optional: true);
}
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>()
.UseUrls("http://0.0.0.0:5677"); // The http port 5677 is only needed for local server with iPhone emulator
});
}
}