Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Nancy self-hosting example
// a simple module to be hosted in the console app
public class MainModule : NancyModule
public MainModule()
Get["/"] = x => { return "Hello World"; };
static void Main(string[] args)
// initialize an instance of NancyHost (found in the Nancy.Hosting.Self package)
var host = new NancyHost(new Uri("http://localhost:12345"));
host.Start(); // start hosting
host.Stop(); // stop hosting
Copy link

zgrkpnr commented Oct 26, 2017

Where do you use MainModule ? Why did you define it if you don't use it.

Copy link

sam453 commented Nov 14, 2017

Nancy automatically discovers all modules so we don’t have to register them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment