37 lines
974 B
C#
37 lines
974 B
C#
using DBConnection;
|
|
using DBConnection.Contexts;
|
|
using DBConnection.Extensions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Newtonsoft.Json;
|
|
using WebNovelPortalAPI.Extensions;
|
|
using WebNovelPortalAPI.Scrapers;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddDbServices(builder.Configuration);
|
|
builder.Services.AddScrapers();
|
|
builder.Services.AddControllers().AddNewtonsoftJson(opt =>
|
|
{
|
|
opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
|
});
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
app.UpdateDatabase<AppDbContext>();
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run(); |