Skip to content

Instantly share code, notes, and snippets.

@grumpydev
Created February 15, 2013 14:04
Show Gist options
  • Save grumpydev/4960559 to your computer and use it in GitHub Desktop.
Save grumpydev/4960559 to your computer and use it in GitHub Desktop.
namespace NancyKatana
{
using System;
using System.Threading.Tasks;
using Nancy;
using NancyKatana.Models;
public class WhyDoIAlwaysCallTheseThingsMainModule : NancyModule
{
public WhyDoIAlwaysCallTheseThingsMainModule()
{
Get["/"] = _ => "Hello!";
Get["/async", true] = async _ =>
{
await Task.Delay(500);
return "Done!";
};
Get["/greet/{name?Nancy}"] = x => new User { Name = x.Name };
Get["/error1"] = x => View["nope"];
Get["/error2"] = x => { throw new Exception("merp"); };
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment