2021-12-13 13:40:04 +01:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
|
|
|
|
namespace zero.Backoffice;
|
|
|
|
|
|
|
|
|
|
public static class ZeroEndpointRouteBuilderExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void MapZeroBackoffice(this IZeroEndpointRouteBuilder endpoints, string path = "/zero")
|
|
|
|
|
{
|
|
|
|
|
endpoints.MapFallbackToController(path.EnsureEndsWith('/') + "{**path}", "Index", "ZeroIndex");
|
2021-12-13 14:28:25 +01:00
|
|
|
//endpoints.MapFallbackToController(path.EnsureEndsWith('/') + "backoffice/{**path}", "Index", "NotFoundZeroApi");
|
2021-12-13 13:40:04 +01:00
|
|
|
//app.UseWhen(ctx => ctx.Request.Path.StartsWithSegments(path + "/api"), app1 =>
|
|
|
|
|
//{
|
|
|
|
|
// app1.UseEndpoints(endpoints =>
|
|
|
|
|
// {
|
|
|
|
|
// //IZeroOptions options = app.ApplicationServices.GetService<IZeroOptions>(); // TODO oO
|
|
|
|
|
// // see https://our.umbraco.com/documentation/reference/routing/custom-routes#where-to-put-your-routing-logic
|
|
|
|
|
// //string path = options.BackofficePath.EnsureStartsWith('/').TrimEnd('/');
|
|
|
|
|
// //endpoints.MapFallbackToController(path + "/{**path}", "Index", "ZeroIndex");
|
|
|
|
|
|
|
|
|
|
// //endpoints.MapControllers();
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
}
|
|
|
|
|
}
|