Inspired by the rails routing api.
public class Routes : RouteSet
{
public Routes()
{
Resource<SessionsController>();
Resources<BlogsController>(() =>
{
As("weblogs");
Only("index", "show");
Collection(x => {
x.Get("latest");
x.Post("someaction");
);
Resources<PostsController>(() =>
{
Except("create", "update", "destroy");
Resources<CommentsController>(() => Except("destroy"));
});
});
}
}
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RestfulRoutingViewEngine());
RouteTable.Routes.MapRoutes<Routes>();
}
}
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don’t break it in a
future version unintentionally. - Send me a pull request. Bonus points for topic branches.