Files
mixtape/zero.Web/ZeroEnpointRouteBuilderExtensions.cs
T

27 lines
971 B
C#
Raw Normal View History

2021-09-29 14:01:02 +02:00
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using zero.Core.Routing;
namespace zero.Web
{
public static class ZeroEndpointRouteBuilderExtensions
{
2021-09-29 15:46:23 +02:00
public static IZeroEndpointRouteBuilder MapZeroBackoffice(this IZeroEndpointRouteBuilder endpoints, string path = "/zero")
2021-09-29 14:01:02 +02:00
{
//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", "ZeroBackoffice");
return endpoints;
}
2021-09-29 15:46:23 +02:00
public static IZeroEndpointRouteBuilder MapZeroRoutes(this IZeroEndpointRouteBuilder endpoints)
2021-09-29 14:01:02 +02:00
{
2021-09-30 10:53:01 +02:00
endpoints.MapDynamicControllerRoute<ZeroRoutesTransformer>("/{**url}", state: null, order: 10);
2021-09-29 14:01:02 +02:00
return endpoints;
}
}
}