Skip to content

Instantly share code, notes, and snippets.

@suminb
Created June 1, 2017 10:02
Show Gist options
  • Save suminb/9e55cc3d35cf1c21f10bd3c19164b96a to your computer and use it in GitHub Desktop.
Save suminb/9e55cc3d35cf1c21f10bd3c19164b96a to your computer and use it in GitHub Desktop.
Nancy self-hosted web service
using System;
using Nancy;
using Nancy.Hosting.Self;
// netsh http add urlacl url="http://+:8029/" user="Everyone"
namespace WebFrontend
{
public class SampleModule : NancyModule
{
public SampleModule()
{
Get["/"] = _ => "Hello World!";
}
}
class Program : Nancy.NancyModule
{
static void Main(string[] args)
{
using (var host = new NancyHost(new Uri("http://localhost:8029")))
{
host.Start();
Console.WriteLine("Running on http://localhost:8029");
Console.ReadLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment