Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created September 13, 2018 01:07
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