jewer / restful-routing

A rails inspired restful routing api for asp .net mvc

Home Page:http://stevehodgkiss.github.com/restful-routing/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A rails inspired restful routing api for asp .net mvc

http://stevehodgkiss.github.com/restful-routing/

License:MIT License