The FubuMVC regex url policy allows you to use regular expressions to ignore/include portions of the url as well as constraining actions to verbs.
PM> Install-Package FubuMVC.RegexUrlPolicy
The following demonstrates how to apply the policy:
public class Conventions : FubuRegistry
{
public Conventions()
{
Routes.RegexUrlPolicy(x => x.
.IgnoreAssemblyNamespace()
.IgnoreClassName()
.IgnoreMethodNames("Execute")
.ConstrainClassToGetEndingWith("GetHandler")
.ConstrainClassToPostEndingWith("PostHandler")
.ConstrainClassToPutEndingWith("PutHandler")
.ConstrainClassToUpdateEndingWith("UpdateHandler")
.ConstrainClassToDeleteEndingWith("DeleteHandler"));
...
}
}
The policy DSL contains the following methods:
IgnoreNamespace()
IgnoreNamespace<T>()
IgnoreNamespace(Type type)
IgnoreNamespaces(params string[] patterns)
IgnoreAssemblyNamespace()
IgnoreAssemblyNamespace<T>()
IgnoreAssemblyNamespace(Type type)
IgnoreClassName()
IgnoreClassNames(params string[] patterns)
IgnoreMethodName()
IgnoreMethodNames(params string[] patterns)
ConstrainNamespaceTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainNamespaceTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainNamespaceTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)
ConstrainClassTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainClassTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainClassTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)
ConstrainMethodTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainMethodTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainMethodTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)