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
public class CustomMiddleware : OwinMiddleware | |
{ | |
public CustomMiddleware(OwinMiddleware next) : base(next) | |
{ | |
} | |
public async override Task Invoke(IOwinContext context) | |
{ | |
context.Response.Headers["MachineName"] = Environment.MachineName; |
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
app.Use(typeof(CustomMiddleware)); |
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
public class Startup | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
// Configure Web API for self-host. | |
var config = new HttpConfiguration(); | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } |
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
[TestFixture] | |
public class SomeTests | |
{ | |
[Setup] | |
public void SomeSetupGoesHere() | |
{ | |
} | |
[Test] |
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
public class Startup | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
// All of our other middleware | |
// ... | |
// Nancy | |
app.UseNancy(); | |
} |
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
public class NancyDemo : NancyModule | |
{ | |
public NancyDemo() | |
{ | |
Get["/nancy/demo"] = parameters => new string[] { "Hello", "World" }; | |
} | |
} |
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
{ | |
"name": "Derek", | |
"links": [ | |
{ | |
"rel": "self", | |
"href": "http://foo/users/derek" | |
}, | |
{ | |
"rel": "topsecret", | |
"href": "http://foo/users/derek/topsecret" |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Builder; | |
using Microsoft.AspNet.Hosting; | |
using Microsoft.AspNet.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
using Nancy.Owin; |
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; | |
namespace AspNet5Nancy | |
{ | |
public class NancyDemoModule : NancyModule | |
{ | |
public NancyDemoModule() | |
{ | |
Get["/nancy/demo"] = parameters => new string[] { "Hello", "World" }; | |
} |
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
public class NancyDemoModule : NancyModule | |
{ | |
public NancyDemoModule() | |
{ | |
Get["/nancy/demo"] = parameters => new[] { "Hello", "World" }; | |
} | |
} |