Many updates for OAP
This commit is contained in:
34
src/OAP/OapApi.v1/Startup.cs
Normal file
34
src/OAP/OapApi.v1/Startup.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Facility.AspNetCore;
|
||||
using Facility.Core.Http;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OapApi.v1.Client;
|
||||
using OapApi.v1.Client.Http;
|
||||
|
||||
namespace OapApi.v1
|
||||
{
|
||||
public class Startup : OrchardCore.Modules.StartupBase
|
||||
{
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<IOapApiV1, OapApiV1>();
|
||||
|
||||
services.AddScoped(sp =>
|
||||
{
|
||||
return new OapApiV1HttpHandler(
|
||||
sp.GetRequiredService<IOapApiV1>(),
|
||||
new ServiceHttpHandlerSettings
|
||||
{
|
||||
RootPath = "/oap/api/v1",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
|
||||
{
|
||||
builder.UseFacilityExceptionHandler();
|
||||
builder.UseFacilityHttpHandler<OapApiV1HttpHandler>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user