This repository was archived by the owner on Jul 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
62 lines (55 loc) · 1.39 KB
/
Program.cs
File metadata and controls
62 lines (55 loc) · 1.39 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Hosting;
using Owin;
using SimpleStack;
using SimpleStack.Serializers.NServicekit;
using SimpleStack.Swagger;
namespace SimpleStack.TestServer
{
internal class Program
{
private static void Main(string[] args)
{
using (WebApp.Start<Startup>("http://localhost:12345"))
{
Console.ReadLine();
}
}
public class TestAppHost : AppHostBase
{
public TestAppHost()
: base("Test app", Assembly.GetExecutingAssembly(),typeof(ApiAllowableValuesAttribute).Assembly)
{
SwaggerApiService.UseCamelCaseModelPropertyNames = true;
SwaggerApiService.UseLowercaseUnderscoreModelPropertyNames = true;
SwaggerApiService.DisableAutoDtoInBodyParam = false;
base.Config.SimpleStackHandlerFactoryPath = "/api";
}
public override void Configure(Funq.Container container)
{
ContentTypeFilters.Register(new JsonContentTypeSerializer());
ContentTypeFilters.Register(new XmlContentTypeSerializer());
}
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
var host = new TestAppHost();
host.Init();
app.UseSimpleStack(host);
#if DEBUG
app.UseErrorPage();
#endif
app.UseWelcomePage("/");
}
}
}
}