MyLab.TaskApp by Andrey O.

<PackageReference Include="MyLab.TaskApp" Version="1.0.0" />

 TaskLogicIntegration

public static class TaskLogicIntegration
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using MyLab.StatusProvider; namespace MyLab.TaskApp { public static class TaskLogicIntegration { public static IServiceCollection AddTaskLogic<T>(this IServiceCollection srv, T logic) where T : ITaskLogic { return StatusProviderIntegration.AddTaskStatusProviding(srv).AddSingleton((ITaskLogic)(object)logic); } public static void AddTaskLogicApi(this IApplicationBuilder app, string basePath = null) { StatusProviderIntegration.AddStatusApi(app, (basePath?.TrimEnd('/') ?? string.Empty) + "/status"); string processingPath = (basePath?.TrimEnd('/') ?? string.Empty) + "/processing"; app.MapWhen(delegate(HttpContext ctx) { if (ctx.Request.Path == (PathString)processingPath) return ctx.Request.Method == "GET"; return false; }, delegate(IApplicationBuilder appB) { appB.Run(async delegate(HttpContext context) { await TaskLogicApiHandler.GetStatus(app, context); }); }); app.MapWhen(delegate(HttpContext ctx) { if (ctx.Request.Path == (PathString)processingPath) return ctx.Request.Method == "POST"; return false; }, delegate(IApplicationBuilder appB) { appB.Run(async delegate(HttpContext context) { await TaskLogicApiHandler.StartLogic(app, context); }); }); } } }