forked from tigernetframework/Tigernet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
43 lines (38 loc) · 1.23 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Text;
using Tigernet.Hosting;
TigernetHostBuilder host = new TigernetHostBuilder();
// add route to the host
host.MapRoute("/", async context =>
{
var response = context.Response;
response.ContentType = "text/html";
var content = Encoding.UTF8.GetBytes("<h1>Welcome to Tigernet Framework</h1>");
response.ContentLength64 = content.Length;
using (var output = response.OutputStream)
{
await output.WriteAsync(content, 0, content.Length);
}
});
host.MapRoute("/about", async context =>
{
var response = context.Response;
response.ContentType = "text/html";
var content = Encoding.UTF8.GetBytes("<h1>About Tigernet Framework</h1>");
response.ContentLength64 = content.Length;
using (var output = response.OutputStream)
{
await output.WriteAsync(content, 0, content.Length);
}
});
host.MapRoute("/contact", async context =>
{
var response = context.Response;
response.ContentType = "text/html";
var content = Encoding.UTF8.GetBytes("<h1>Contact Tigernet Framework</h1>");
response.ContentLength64 = content.Length;
using (var output = response.OutputStream)
{
await output.WriteAsync(content, 0, content.Length);
}
});
await host.Start();