72 lines
1.8 KiB
C#
Executable File
72 lines
1.8 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
// using AuthModule;
|
|
// using AuthModule.Services;
|
|
using ECommerceModule.Config;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Http;
|
|
|
|
namespace UI.Config.Register;
|
|
|
|
public static class RegisteringServices
|
|
{
|
|
public static IServiceCollection RegisterServices(
|
|
this IServiceCollection services,
|
|
IConfiguration config
|
|
)
|
|
{
|
|
services.AddHTTPClients(config);
|
|
services.RegisteredServices();
|
|
|
|
return services;
|
|
}
|
|
|
|
public static IServiceCollection RegisteredServices(this IServiceCollection services)
|
|
{
|
|
// services.AuthModuleServices();
|
|
services.ECommerceModuleServices();
|
|
|
|
// Common Services
|
|
services.AddScoped<Common.Services.IToastService, Common.Services.ToastService>();
|
|
|
|
// Commerce Module Services
|
|
|
|
return services;
|
|
}
|
|
|
|
public static IServiceCollection AddHTTPClients(
|
|
this IServiceCollection services,
|
|
IConfiguration config
|
|
)
|
|
{
|
|
services.AddHttpClient(
|
|
"Auth",
|
|
client =>
|
|
{
|
|
client.BaseAddress = new Uri("http://localhost:2002/api/v1/");
|
|
}
|
|
);
|
|
services.AddHttpClient(
|
|
"Commerce",
|
|
client =>
|
|
{
|
|
client.BaseAddress = new Uri("http://localhost:2001/api/v1/");
|
|
}
|
|
);
|
|
services.AddHttpClient(
|
|
"CDN",
|
|
client =>
|
|
{
|
|
client.BaseAddress = new Uri("http://localhost:2003/api/v1/");
|
|
}
|
|
);
|
|
|
|
return services;
|
|
}
|
|
}
|