Created
November 19, 2013 19:51
-
-
Save davidwhitney/7551413 to your computer and use it in GitHub Desktop.
codedojo29
This file contains hidden or 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; | |
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