Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 1.38 KB

README.textile

File metadata and controls

55 lines (45 loc) · 1.38 KB

Restful Routing for ASP .NET MVC

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>();
    }
}

Read more

Note on Patches/Pull Requests

  • 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.

Contributors