Created
September 13, 2018 01:07
-
-
Save dcomartin/9942a6636200ca7e49c5065f5b6442e3 to your computer and use it in GitHub Desktop.
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.Threading; | |
using System.Threading.Tasks; | |
using Nancy; | |
public class DemoModule: NancyV1Module | |
{ | |
public DemoModule() | |
{ | |
Get["named", "/sync"] = DoSync; | |
Get["/sync/noname"] = DoSync; | |
Get["named", "/async/named", true] = DoAsync; | |
Get["/async/noname", true] = DoAsync; | |
} | |
private object DoSync(dynamic o) | |
{ | |
return "Hello World"; | |
} | |
private Task<object> DoAsync(dynamic o, CancellationToken token) | |
{ | |
return Task.FromResult("Hello World" as object); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment