Major update
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serilog;
|
||||
using Teams;
|
||||
using Teams.DbContexts;
|
||||
using Teams.Services;
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Debug()
|
||||
@@ -16,22 +15,17 @@ builder.Host.UseSerilog();
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.ReturnHttpNotAcceptable = true;
|
||||
}).AddXmlDataContractSerializerFormatters();
|
||||
builder.Services.AddMediatR(typeof(Program));
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
builder.Services.AddDbContext<MlbGameDayContext>(dbContextOptions =>
|
||||
builder.Services.AddDbContext<TeamsContext>(dbContextOptions =>
|
||||
dbContextOptions.UseNpgsql(builder.Configuration["ConnectionStrings:DBConnectionString"])
|
||||
);
|
||||
|
||||
builder.Services.AddScoped<ITeamsRepository, TeamsRepository>();
|
||||
|
||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -47,10 +41,7 @@ app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user