Add project files.
This commit is contained in:
55
ConstructorAppApi/Program.cs
Normal file
55
ConstructorAppApi/Program.cs
Normal 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();
|
||||
Reference in New Issue
Block a user