Skip to content

Instantly share code, notes, and snippets.

@mefellows
Created March 18, 2015 00:05
Show Gist options
  • Save mefellows/1fd4128faed609103479 to your computer and use it in GitHub Desktop.
Save mefellows/1fd4128faed609103479 to your computer and use it in GitHub Desktop.
Demo Nancy .NET Hello World API
using Nancy;
namespace NancyDemo
{
public class HelloModule : NancyModule
{
public HelloModule()
{
Get["/"] = parameters => "Hello World";
}
}
}
using System;
using System.Threading;
using Nancy.Hosting.Self;
using System.Linq;
namespace NancyDemo
{
class Program
{
static void Main(string[] args)
{
var uri = "http://localhost:8888";
var host = new NancyHost(new Uri(uri));
Console.WriteLine ("Starting on port 8888");
host.Start(); // start hosting
Console.WriteLine ("started!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment