Created
June 1, 2017 10:02
-
-
Save suminb/9e55cc3d35cf1c21f10bd3c19164b96a to your computer and use it in GitHub Desktop.
Nancy self-hosted web service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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