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

31 lines
1.2 KiB
C#
Raw Normal View History

2021-11-20 13:52:28 +01:00
using Microsoft.AspNetCore.Builder;
namespace zero.Routing;
public static class ZeroEndpointRouteBuilderExtensions
{
2021-12-12 15:41:51 +01:00
public static void UseZeroBackoffice(this IApplicationBuilder app, string path = "/zero")
2021-11-20 13:52:28 +01:00
{
2021-12-12 15:41:51 +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");
2021-11-20 13:52:28 +01:00
2021-12-12 15:41:51 +01:00
// //endpoints.MapControllers();
// });
//});
2021-11-20 13:52:28 +01:00
}
public static IZeroEndpointRouteBuilder MapZeroRoutes(this IZeroEndpointRouteBuilder endpoints)
{
endpoints.MapDynamicControllerRoute<ZeroRoutesTransformer>("/{**url}", state: ZeroRoutesTransformerType.Controller, order: 10);
endpoints.MapDynamicPageRoute<ZeroRoutesTransformer>("/{**url}", state: ZeroRoutesTransformerType.Page, order: 11);
2021-11-20 13:52:28 +01:00
return endpoints;
}
}