Revize 21eac145
Přidáno uživatelem Lukáš Vlček před více než 2 roky(ů)
Backend/Backend/Program.cs | ||
---|---|---|
65 | 65 |
RegisterMappings.Register(builder); |
66 | 66 |
var app = builder.Build(); |
67 | 67 |
|
68 |
|
|
69 |
app.UsePathBase("/law"); |
|
70 |
|
|
68 | 71 |
// Enable DateTime in PostgreSQL |
69 | 72 |
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); |
70 | 73 |
|
... | ... | |
76 | 79 |
app.UseSwaggerUI(); |
77 | 80 |
} |
78 | 81 |
|
79 |
app.UsePathBase(new PathString("/law")); |
|
80 |
|
|
81 | 82 |
// CORS |
82 | 83 |
app.UseCors(builder => builder |
83 |
.AllowAnyHeader()
|
|
84 |
.AllowAnyMethod()
|
|
85 |
.SetIsOriginAllowed(_ => true)
|
|
86 |
.AllowCredentials()
|
|
87 |
);
|
|
84 |
.AllowAnyHeader() |
|
85 |
.AllowAnyMethod() |
|
86 |
.SetIsOriginAllowed(_ => true) |
|
87 |
.AllowCredentials() |
|
88 |
); |
|
88 | 89 |
|
90 |
app.UseRouting(); |
|
89 | 91 |
|
90 | 92 |
// JWT Authentication |
91 | 93 |
app.UseMiddleware<JwtMiddleware>(); |
... | ... | |
93 | 95 |
// Error handling middleware |
94 | 96 |
app.UseMiddleware<ErrorMiddleware>(); |
95 | 97 |
|
98 |
app.MapGet("/", () => "It works!"); |
|
99 |
|
|
96 | 100 |
app.MapControllers(); |
97 | 101 |
|
98 | 102 |
// Logging |
99 | 103 |
app.UseSerilogRequestLogging(); |
100 | 104 |
app.Logger.LogInformation("Starting up"); |
101 | 105 |
|
106 |
|
|
107 |
|
|
102 | 108 |
// Database seeding |
103 | 109 |
using (var scope = app.Services.CreateScope()) |
104 | 110 |
{ |
Backend/Backend/appsettings.Development.json | ||
---|---|---|
6 | 6 |
} |
7 | 7 |
}, |
8 | 8 |
"AllowedHosts": "*", |
9 |
"ConnectionString": "Host=localhost:5432;Database=dbo;Username=myuser;Password=password;Include Error Detail=true;",
|
|
9 |
"ConnectionString": "Host=localhost:5432;Database=aswi;Username=myuser;Password=password;Include Error Detail=true;",
|
|
10 | 10 |
"JwtConfig": { |
11 | 11 |
"Secret": "CJgvc9BtwJjnCExzKLB2ndtxERW3YMhqMMPNrBZuTJaskPqRVfZQHRUnbRHH9Ekp5zsaTSeM73vQSKvq48w2u8jTnKUn7Uhk2zBeD9wLz48ssKMppNC9HDTXSk6RWP5PtXfCayJ67mbUWF6aknnteLg4sDKzqYeNYjyw8Jk6", |
12 | 12 |
"Issuer": "0x00.server" |
Také k dispozici: Unified diff
BE useRouting changed