Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (36 sloc) 1.167 kb
0c2721e @loudej Adding extremely simple HelloWorld sample
authored
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
e7bfe4d @loudej Renaming project to Firefly
authored
4 using Firefly.Http;
29d1d85 @loudej Switching to Owin 0.7 package
authored
5 using Owin;
0c2721e @loudej Adding extremely simple HelloWorld sample
authored
6
7 namespace HelloWorld
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 var server = new ServerFactory();
14 using (server.Create(App, 8080))
15 {
c8acb32 @friesencr Update src/sample/HelloWorld/Program.cs
friesencr authored
16 Console.WriteLine("Running server on http://localhost:8080/");
0c2721e @loudej Adding extremely simple HelloWorld sample
authored
17 Console.WriteLine("Press enter to exit");
18 Console.ReadLine();
19 }
20 }
21
22 private static void App(IDictionary<string, object> env, ResultDelegate result, Action<Exception> fault)
23 {
24 result(
25 "200 OK",
26 new Dictionary<string, IEnumerable<string>>(StringComparer.OrdinalIgnoreCase)
541d0a7 @loudej Ran R# code cleanup
authored
27 {
28 {"Content-Type", new[] {"text/plain"}}
29 },
29d1d85 @loudej Switching to Owin 0.7 package
authored
30 (write, flush, end, cancel) =>
31 {
32 var bytes = Encoding.Default.GetBytes("Hello world!");
33 write(new ArraySegment<byte>(bytes));
34 end(null);
35 });
0c2721e @loudej Adding extremely simple HelloWorld sample
authored
36 }
37 }
38 }
Something went wrong with that request. Please try again.