Files
mixtape/zero.Core/Routing/ZeroEnpointRouteBuilderExtensions.cs
T

24 lines
875 B
C#
Raw Normal View History

2021-11-20 13:52:28 +01:00
using Microsoft.AspNetCore.Builder;
namespace zero.Routing;
public static class ZeroEndpointRouteBuilderExtensions
{
public static IZeroEndpointRouteBuilder MapZeroBackoffice(this IZeroEndpointRouteBuilder endpoints, string path = "/zero")
{
//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('/');
2021-11-23 22:56:22 +01:00
endpoints.MapFallbackToController(path + "/{**path}", "Index", "ZeroIndex");
2021-11-20 13:52:28 +01:00
return endpoints;
}
public static IZeroEndpointRouteBuilder MapZeroRoutes(this IZeroEndpointRouteBuilder endpoints)
{
endpoints.MapDynamicControllerRoute<ZeroRoutesTransformer>("/{**url}", state: null, order: 10);
return endpoints;
}
}