Skip to content

Instantly share code, notes, and snippets.

@stevehodgkiss
Created January 28, 2010 13:07
Show Gist options
  • Save stevehodgkiss/288722 to your computer and use it in GitHub Desktop.
Save stevehodgkiss/288722 to your computer and use it in GitHub Desktop.
// ideas for the new restful-routing dsl, inspired by the rails 3 router
public class WebsiteApp : RestfulRoutingApp
{
public WebsiteApp()
{
Resource<SessionController>(() => Only.New.Create);
Namespace("admin", () =>
{
Resources<BlogsController>(() =>
{
As("weblogs");
Member(x => x.Download()).Verbs(x => x.Get);
Member(x => x.Up()).Verbs(x => x.Put);
Member(x => x.Down()).Verbs(x => x.Delete);
});
});
Constrain(id => @"\d+", () =>
{
Resources<BlogsController>();
});
Map("something/{id}").To<PagesController>(x => x.Something()).Constrain(id => @"\d+");
Map("blogs").To<BlogsApp>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment