Skip to content

Instantly share code, notes, and snippets.

@davidwhitney
Created November 19, 2013 19:51
Show Gist options
  • Save davidwhitney/7551413 to your computer and use it in GitHub Desktop.
Save davidwhitney/7551413 to your computer and use it in GitHub Desktop.
codedojo29
using System;
using Nancy;
using Nancy.Hosting.Self;
namespace WebServer
{
class Program
{
static void Main()
{
var hostConfig = new HostConfiguration {UrlReservations = new UrlReservations {CreateAutomatically = true}};
var nancyHost = new NancyHost(new Uri("http://localhost:8888/"), new DefaultNancyBootstrapper() ,hostConfig);
nancyHost.Start();
Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/. Press enter to stop");
//Process.Start("http://localhost:8888/");
Console.ReadKey();
nancyHost.Stop();
Console.WriteLine("Stopped. Good bye!");
}
}
public class Module : NancyModule
{
public Module()
{
Get["/"] = parameters => HandleQuery(parameters); //"Hello World";
}
private string HandleQuery(dynamic parameters)
{
var query = "Query: ";
query += Request.Url.Query;
Debug.WriteLine(query);
return query;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment