Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Nancy;
- using Nancy.Hosting.Self;
- public class StructuredHello
- {
- public string Message { get; set; }
- public string For { get; set; }
- }
- public class HelloModule : NancyModule
- {
- public static StructuredHello _Hello
- = new StructuredHello
- {
- Message = "Hello",
- For = "You"
- };
- public HelloModule()
- {
- Get["/"] = parameters => Response.AsJson(_Hello);
- }
- }
- class Program
- {
- static void Main()
- {
- Uri uri = new Uri("http://localhost:1234");
- using (NancyHost host = new NancyHost(uri))
- {
- host.Start();
- Console.WriteLine("Running on {0}", uri);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement