Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A rails inspired restful routing api for asp .net mvc
JavaScript C# ASP Ruby
Pull request Compare This branch is 105 commits behind stevehodgkiss:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
content
lib
src
tools
.gitignore
CHANGELOG.txt
MIT-LICENSE.txt
README.textile
Rakefile
RestfulRouting.nuspec

README.textile

Restful Routing for ASP .NET MVC

Inspired by the rails routing api.

public class Routes : RouteSet
{
	public override void Map(Mapper map)
	{
		map.Root<HomeController>(x => x.Show());
		map.Path("test/{id}").To<TestController>(x => x.Test()).Constrain("id", @"\d+");
		map.Resource<SessionsController>();
		map.Resources<BlogsController>(blogs =>
		{
			blogs.As("weblogs");
			blogs.Only("index", "show");
			blogs.Collection(x => {
				x.Get("latest");
				x.Post("someaction");
			);
			blogs.Member(x => x.Put("move"));

			blogs.Resources<PostsController>(posts =>
			{
				posts.Except("create", "update", "destroy");
				posts.Resources<CommentsController>(c => c.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

Written by Steve Hodgkiss with contributions from

Something went wrong with that request. Please try again.