forked from gothinkster/realworld-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
32 lines (27 loc) · 818 Bytes
/
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
global using FastEndpoints;
global using FastEndpoints.Security;
global using FluentValidation;
global using MongoDB.Entities;
using System.Text.Json;
using AgileObjects.AgileMapper;
using FastEndpoints.Swagger;
var builder = WebApplication.CreateBuilder();
builder.Services.AddFastEndpoints();
builder.Services.AddJWTBearerAuth(JWT.jwtSigningKey);
builder.Services.AddSwaggerDoc();
var app = builder.Build();
// app.UseFastEndpoints();
app.UseFastEndpoints(c =>
{
// c.Endpoints.Configurator = ep =>
// {
// ep.PreProcessors(FastEndpoints.Order.Before, new ErrorHandler.EmptyRequest());
// };
});
// app.MyExceptionHandler();
app.UseDefaultExceptionHandler();
app.UseAuthentication();
app.UseAuthorization();
app.UseSwaggerGen();
await DB.InitAsync(database: "conduit", host: "localhost");
app.Run();