-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
61 lines (50 loc) · 2.05 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
59
60
61
/*
* _ _ _ _ _ ____ _
* | | | |___ ___ _ __ / \ _ _| |_| |__ / ___| ___ _ ____ _(_) ___ ___
* | | | / __|/ _ \ '__/ _ \| | | | __| '_ \\___ \ / _ \ '__\ \ / / |/ __/ _ \
* | |_| \__ \ __/ | / ___ \ |_| | |_| | | |___) | __/ | \ V /| | (_| __/
* \___/|___/\___|_|/_/ \_\__,_|\__|_| |_|____/ \___|_| \_/ |_|\___\___|
*
* Copyright (C) 2024 pixelwhiz
*
* This software is distributed under "GNU General Public License v3.0".
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License v3.0
* along with this program. If not, see <https://opensource.org/licenses/GPL-3.0>.
*/
using Microsoft.EntityFrameworkCore;
using UserAuthService.entity;
using UserAuthService.Services;
namespace UserAuthService
{
internal class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var connection = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseMySql(connection, new MySqlServerVersion(new Version(8, 0, 21))));
builder.Services.AddScoped<IAuthService, AuthServiceHandler>();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}
}