Add project files.

This commit is contained in:
2025-05-01 15:18:30 +03:00
parent e058ab8015
commit 774d695414
3094 changed files with 1336814 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
using ConstructorApp.DataAccessLayer.Concrete;
using Microsoft.EntityFrameworkCore;
using ConstructorApp.BusinessLayer.Extensions;
using ConstructorAppApi.Hubs;
using ConstructorApp.EntityLayer.Entities;
using Microsoft.AspNetCore.Identity;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddCors(opt =>
{
opt.AddPolicy("CorsPolicy", builder =>
{
builder.AllowAnyHeader()
.AllowAnyMethod()
.SetIsOriginAllowed((host) => true)
.AllowCredentials();
});
});
builder.Services.AddSignalR();
builder.Services.AddDbContext<ConstructorContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("mssql")));
// AutoMapper ve di<64>er ba<62><61>ml<6D>l<EFBFBD>klar
builder.Services.AddIdentity<AppUser, AppRole>()
.AddEntityFrameworkStores<ConstructorContext>()
.AddDefaultTokenProviders();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddBusinessLayerDependencies();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
//if (app.Environment.IsDevelopment())
//{
// app.UseSwagger();
// app.UseSwaggerUI();
//}
app.UseSwagger();
app.UseSwaggerUI();
app.UseCors("CorsPolicy");
//app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.MapHub<SignalRHub>("/signalrhub");
app.Run();