Foxchat.NET/Foxchat.Chat/Extensions/WebApplicationExtensions.cs

28 lines
816 B
C#
Raw Permalink Normal View History

using Foxchat.Chat.Middleware;
2024-05-21 20:14:52 +02:00
using Foxchat.Chat.Services;
using Foxchat.Core.Middleware;
namespace Foxchat.Chat.Extensions;
public static class WebApplicationExtensions
{
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
{
return services
2024-05-21 20:14:52 +02:00
.AddScoped<ErrorHandlerMiddleware>()
.AddScoped<ServerAuthenticationMiddleware>();
}
public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
{
return app
2024-05-21 20:14:52 +02:00
.UseMiddleware<ErrorHandlerMiddleware>()
.UseMiddleware<ServerAuthenticationMiddleware>();
}
public static IServiceCollection AddChatServices(this IServiceCollection services)
{
return services
.AddScoped<UserResolverService>();
}
}