FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Playtesters.API/src/Program.cs at master · DevD4v3/Playtesters.API · GitHub
DevD4v3
/
Playtesters.API
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
6
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Playtesters.API
/
src
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (36 loc) · 1.17 KB
Breadcrumbs
Playtesters.API
/
src
/
Program.cs
Copy path
File metadata and controls
42 lines (36 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
DotEnv
.
Core
;
using
Microsoft
.
EntityFrameworkCore
;
using
Playtesters
.
API
.
Data
;
using
Playtesters
.
API
.
Endpoints
;
using
Playtesters
.
API
.
ExceptionHandlers
;
using
Playtesters
.
API
.
Extensions
;
using
Playtesters
.
API
.
Middlewares
;
var
builder
=
WebApplication
.
CreateBuilder
(
args
)
;
var
envVars
=
new
EnvLoader
(
)
.
Load
(
)
;
var
dataSource
=
envVars
[
"SQLITE_DATA_SOURCE"
]
??
"playtesters.db"
;
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder
.
Services
.
AddEndpointsApiExplorer
(
)
;
builder
.
Services
.
AddSwaggerWithApiKey
(
)
;
builder
.
Services
.
AddServices
(
)
;
builder
.
Services
.
AddExceptionHandler
<
GlobalExceptionHandler
>
(
)
;
builder
.
Services
.
AddDbContext
<
AppDbContext
>
(
options
=>
options
.
UseSqlite
(
$
"Data Source=
{
dataSource
}
"
)
)
;
var
app
=
builder
.
Build
(
)
;
await
app
.
MigrateDatabaseAsync
(
)
;
app
.
UseRequestLocalization
(
"en"
)
;
// Configure the HTTP request pipeline.
if
(
app
.
Environment
.
IsDevelopment
(
)
)
{
app
.
UseSwagger
(
)
;
app
.
UseSwaggerUI
(
)
;
}
else
{
app
.
UseExceptionHandler
(
"/"
)
;
}
app
.
UseMiddleware
<
ApiKeyMiddleware
>
(
)
;
app
.
UseHttpsRedirection
(
)
;
app
.
MapTesterEndpoints
(
)
;
app
.
Run
(
)
;
public
partial
class
Program
{
}
Back
|
FazBrowse Home
|
New Git URL