|
@@ -38,7 +38,7 @@ var config = new AppSettingsConfiguration();
|
|
// Add services to the container.
|
|
// Add services to the container.
|
|
builder.Services.AddDbContext<HRDataContext>(options =>
|
|
builder.Services.AddDbContext<HRDataContext>(options =>
|
|
{
|
|
{
|
|
- options.UseSqlServer(config.ConnectionStrings.LocalConnectionString);
|
|
|
|
|
|
+ options.UseSqlServer(config.ConnectionStrings.mt);
|
|
// options.UseSqlServer(builder.Configuration.GetSection("ConnectionStrings:MTWorkHRConnectionString").Value);
|
|
// options.UseSqlServer(builder.Configuration.GetSection("ConnectionStrings:MTWorkHRConnectionString").Value);
|
|
});
|
|
});
|
|
|
|
|
|
@@ -106,6 +106,11 @@ builder.Services.ConfigureReportingServices(configurator => {
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
//builder.Services.AddSwaggerGen();
|
|
//builder.Services.AddSwaggerGen();
|
|
//--------------------------
|
|
//--------------------------
|
|
|
|
+builder.Services.AddSignalR(options =>
|
|
|
|
+{
|
|
|
|
+ options.EnableDetailedErrors = true;
|
|
|
|
+});
|
|
|
|
+
|
|
builder.Services.AddSwaggerGen(swagger =>
|
|
builder.Services.AddSwaggerGen(swagger =>
|
|
{
|
|
{
|
|
//This is to apply global headers for all requests
|
|
//This is to apply global headers for all requests
|
|
@@ -152,10 +157,7 @@ builder.Services.AddSwaggerGen(swagger =>
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
-builder.Services.AddSignalR(options =>
|
|
|
|
-{
|
|
|
|
- options.EnableDetailedErrors = true;
|
|
|
|
-});
|
|
|
|
|
|
+
|
|
//--------------------------
|
|
//--------------------------
|
|
var app = builder.Build();
|
|
var app = builder.Build();
|
|
|
|
|
|
@@ -168,7 +170,11 @@ app.UseSwagger();
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MTWorkHR.API v1"));
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MTWorkHR.API v1"));
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+
|
|
|
|
+app.UseRouting(); // <-- Add UseRouting() here
|
|
|
|
+
|
|
app.UseCors(x => x
|
|
app.UseCors(x => x
|
|
|
|
+ .WithOrigins("https://api.mtwork.com", "https://mtworkhrclient.azurewebsites.net", "http://localhost:4200/") // Allowed origin
|
|
.AllowAnyMethod()
|
|
.AllowAnyMethod()
|
|
.AllowAnyHeader()
|
|
.AllowAnyHeader()
|
|
.SetIsOriginAllowed(origin =>
|
|
.SetIsOriginAllowed(origin =>
|
|
@@ -176,21 +182,20 @@ app.UseCors(x => x
|
|
.AllowCredentials()); // allow credentials
|
|
.AllowCredentials()); // allow credentials
|
|
|
|
|
|
|
|
|
|
-//app.MapPost("broadcast", async (string message, IHubContext<ChatHub, IChatClient> context) =>
|
|
|
|
-//{
|
|
|
|
-// await context.Clients.All.ReceiveMessage(message);
|
|
|
|
-// return Results.NoContent();
|
|
|
|
-//});
|
|
|
|
|
|
|
|
-//app.UseEndpoints(endpoints =>
|
|
|
|
-//{
|
|
|
|
-// endpoints.MapHub<ChatHub>("/chatHub");
|
|
|
|
-//});
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
app.UseHttpsRedirection();
|
|
app.UseHttpsRedirection();
|
|
app.UseAuthentication();
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
app.UseAuthorization();
|
|
|
|
+app.UseEndpoints(endpoints =>
|
|
|
|
+{
|
|
|
|
+ endpoints.MapHub<ChatHub>("/chatHub"); // Map your SignalR hub
|
|
|
|
+});
|
|
app.UseMiddleware<LoggingMiddleware>();
|
|
app.UseMiddleware<LoggingMiddleware>();
|
|
app.MapControllers();
|
|
app.MapControllers();
|
|
-app.MapHub<ChatHub>("/chatHub");
|
|
|
|
|
|
+//app.MapHub<ChatHub>("/chatHub");
|
|
|
|
|
|
app.Run();
|
|
app.Run();
|