Created
March 4, 2015 15:24
-
-
Save stephenpope/1a59dfa94794146caad6 to your computer and use it in GitHub Desktop.
Getting a vNext HttpContext feature using Nancy
This file contains 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
using Nancy; | |
using Nancy.Owin; | |
public class HomeModule : NancyModule | |
{ | |
public HomeModule() | |
{ | |
Get["/{id?}"] = _ => | |
{ | |
var owin = this.Context.GetOwinEnvironment(); | |
var http = (HttpContext)owin[typeof(HttpContext).FullName]; | |
var myFeature = http.GetFeature<MyFeature>(); | |
return myFeature.DoSomething(); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! 😁
You could wrap that in an extension method
So your module becomes
✨👯