2023-12-10 21:53:47 +08:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
using WebApi.Data;
|
|
|
|
|
2023-12-05 19:18:38 +08:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
|
2023-12-10 21:53:47 +08:00
|
|
|
// builder.Services.AddIdentityApiEndpoints<IdentityUser>();
|
|
|
|
// builder.Services.AddIdentity<IdentityUser,IdentityRole>();
|
|
|
|
|
|
|
|
builder.Services.AddDbContext<ApplicationIdentityDbContext>(options => options.UseSqlite());
|
|
|
|
builder.Services.AddDbContext<DictionaryDbContext>();
|
|
|
|
|
|
|
|
builder.Services.AddAuthorization();
|
|
|
|
|
|
|
|
builder.Services.AddIdentityApiEndpoints<IdentityUser>().AddEntityFrameworkStores<ApplicationIdentityDbContext>();
|
|
|
|
|
2023-12-05 19:18:38 +08:00
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
|
|
|
app.UseSwaggerUI();
|
|
|
|
}
|
|
|
|
|
2023-12-10 21:53:47 +08:00
|
|
|
// app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
app.MapIdentityApi<IdentityUser>();
|
2023-12-05 19:18:38 +08:00
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
app.Run();
|