-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
58 lines (45 loc) · 1.69 KB
/
Program.cs
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
54
55
56
57
58
using CustomerOrdersApi.Config;
using MongoDB.Bson.Serialization.Conventions;
namespace CustomerOrdersApi
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var env = builder.Environment;
builder.Configuration
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
var pack = new ConventionPack();
pack.Add(new CamelCaseElementNameConvention());
ConventionRegistry.Register("camel case", pack, t => true);
// Add services to the container.
builder.Services
.Configure<AppSettings>(builder.Configuration)
.AddControllers()
/*
.AddMvcOptions(c =>
{
c.EnableEndpointRouting = false;
c.OutputFormatters.Add(new JsonHalOutputFormatter(
new Newtonsoft.Json.JsonSerializerSettings(),
halJsonMediaTypes: new string[] { "application/hal+json", "application/vnd.example.hal+json", "application/vnd.example.hal.v1+json" }
));
})*/
;
var app = builder.Build();
// Configure the HTTP request pipeline.
//app.UseHttpsRedirection();
//app.UseAuthorization();
app.MapControllers();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run();
}
}
}