Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created September 13, 2018 01:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dcomartin/9942a6636200ca7e49c5065f5b6442e3 to your computer and use it in GitHub Desktop.
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