....
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Infrastructure.Repository;
|
||||
using Back.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TaxPayer.Infrastructure.Persistence;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
@@ -6,6 +12,23 @@ builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddDbContext<SqlDbContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("Base"));
|
||||
});
|
||||
builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>));
|
||||
builder.Services.AddScoped<Back.Services.ServBase>();
|
||||
string origins = "OriginTaxPayer";
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(origins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5107")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -17,7 +40,7 @@ if (app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors(origins);
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
Reference in New Issue
Block a user