root / trunk / Pithos.TestServer / Program.cs @ ac8b664d
History | View | Annotate | Download (1.4 kB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using System.Web.Http; |
7 |
using System.Web.Http.SelfHost; |
8 |
|
9 |
namespace Pithos.TestServer |
10 |
{ |
11 |
class Program |
12 |
{ |
13 |
static void Main(string[] args) |
14 |
{ |
15 |
var config = new HttpSelfHostConfiguration("http://localhost:30999"); |
16 |
/* |
17 |
|
18 |
config.Routes.MapHttpRoute( |
19 |
"API Default", "api/{controller}/{id}", |
20 |
new { id = RouteParameter.Optional }); |
21 |
*/ |
22 |
config.Routes.MapHttpRoute( |
23 |
"Root1", "v1.0", |
24 |
new { controller = "Root" }); |
25 |
|
26 |
config.Routes.MapHttpRoute( |
27 |
"Root", "v1", |
28 |
new { controller = "Root" }); |
29 |
|
30 |
config.Routes.MapHttpRoute( |
31 |
"Account", "v1/{account}", |
32 |
new { controller = "Root" }); |
33 |
|
34 |
config.Routes.MapHttpRoute( |
35 |
"Container", "v1/{account}/{container}", |
36 |
new { controller = "Root" }); |
37 |
|
38 |
config.Routes.MapHttpRoute( |
39 |
"Users", "user_catalogs", |
40 |
new { controller = "Users" }); |
41 |
|
42 |
|
43 |
using (var server = new HttpSelfHostServer(config)) |
44 |
{ |
45 |
server.OpenAsync().Wait(); |
46 |
|
47 |
Console.WriteLine("Press Enter to quit."); |
48 |
Console.ReadLine(); |
49 |
} |
50 |
} |
51 |
} |
52 |
} |