Skip to content

Instantly share code, notes, and snippets.

@laurentkempe
Created April 14, 2014 13:33
Show Gist options
  • Save laurentkempe/10648289 to your computer and use it in GitHub Desktop.
Save laurentkempe/10648289 to your computer and use it in GitHub Desktop.
NancyModule
public class Router : NancyModule, IRouter
{
public Router()
: base("/")
{
Get["test"] = x => "hello";
}
public void HttpGet(string path, Func<dynamic, dynamic> action)
{
Get[path] = x => action;
}
/// <summary>
/// Gets all declared routes by the module.
/// </summary>
/// <value>
/// A <see cref="T:System.Collections.Generic.IEnumerable`1"/> instance, containing all <see cref="T:Nancy.Routing.Route"/> instances declared by the module.
/// </value>
/// <remarks>
/// This is automatically set by Nancy at runtime.
/// </remarks>
public override IEnumerable<Route> Routes
{
get { return base.Routes; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment