hm
This commit is contained in:
@@ -78,5 +78,12 @@
|
||||
public const string FolderAlias = "zero.folder";
|
||||
public const string DefaultRootPageTypeAlias = "root";
|
||||
}
|
||||
|
||||
public static class Routing
|
||||
{
|
||||
public const string InternalRoutePrefix = "/__zero/";
|
||||
|
||||
public const string ErrorRoute = InternalRoutePrefix + "error";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace zero.Core.Options
|
||||
DefaultEndpoint = new("ZeroFrontend", "Index");
|
||||
EndpointResolvers = new();
|
||||
PageResolvers = new();
|
||||
ErrorReexecutionPath = "/error";
|
||||
}
|
||||
|
||||
|
||||
@@ -26,5 +27,10 @@ namespace zero.Core.Options
|
||||
///
|
||||
/// </summary>
|
||||
public RoutingPageResolverOptions PageResolvers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ErrorReexecutionPath { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.Routing;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace zero.Core.Routing
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using zero.Core;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Options;
|
||||
using zero.Core.Routing;
|
||||
@@ -15,6 +17,11 @@ namespace zero.Web
|
||||
|
||||
string path = options.BackofficePath.EnsureStartsWith('/').TrimEnd('/');
|
||||
|
||||
if (!options.Routing.ErrorReexecutionPath.IsNullOrEmpty())
|
||||
{
|
||||
app.UseStatusCodePagesWithReExecute(options.Routing.ErrorReexecutionPath.EnsureStartsWith('/'), "?statusCode={0}");
|
||||
}
|
||||
|
||||
app.UseMiddleware<ZeroContextMiddleware>();
|
||||
|
||||
app.UseStaticFiles();
|
||||
@@ -61,7 +68,7 @@ namespace zero.Web
|
||||
{
|
||||
return app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapDynamicControllerRoute<ZeroRoutesTransformer>("{**url}");
|
||||
endpoints.MapDynamicControllerRoute<ZeroRoutesTransformer>("{**url}", state: null, order: 10);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user