29 lines
750 B
C#
29 lines
750 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using GameServer.Data;
|
|
using Scalar.AspNetCore;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// appsettings.json에서 연결 문자열(Connection String) 가져오기
|
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
|
|
|
// MariaDB(Pomelo) 엔진 등록
|
|
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
|
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddOpenApi();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.MapOpenApi();
|
|
app.MapScalarApiReference();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseAuthorization();
|
|
app.MapControllers();
|
|
|
|
app.Run(); |