Last active
December 11, 2015 02:18
-
-
Save grumpydev/4529503 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NooVerbs | |
{ | |
public class MyBadgerModule : NooModuleBase | |
{ | |
public MyBadgerModule() | |
{ | |
this.Badger["/"] = _ => "erm"; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NooVerbs | |
{ | |
using System.Reflection; | |
using Nancy; | |
public class MyBootstrapper : DefaultNancyBootstrapper | |
{ | |
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) | |
{ | |
base.ApplicationStartup(container, pipelines); | |
pipelines.BeforeRequest += ctx => | |
{ | |
if (ctx.Request.Method == "GET") | |
{ | |
var prop = typeof(Request).GetProperty("Method", BindingFlags.Public | BindingFlags.Instance); | |
prop.SetValue(ctx.Request, "Badger", null); | |
} | |
return null; | |
}; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NooVerbs | |
{ | |
using Nancy; | |
public abstract class NooModuleBase : NancyModule | |
{ | |
protected NooModuleBase() | |
{ | |
} | |
protected NooModuleBase(string modulePath) | |
: base(modulePath) | |
{ | |
} | |
public RouteBuilder Badger | |
{ | |
get { return new RouteBuilder("Badger", this); } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment