Created
March 18, 2015 00:05
-
-
Save mefellows/1fd4128faed609103479 to your computer and use it in GitHub Desktop.
Demo Nancy .NET Hello World API
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 Nancy; | |
namespace NancyDemo | |
{ | |
public class HelloModule : NancyModule | |
{ | |
public HelloModule() | |
{ | |
Get["/"] = parameters => "Hello World"; | |
} | |
} | |
} |
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 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