Skip to content

jewer/restful-routing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published