/
Global.asax.cs
47 lines (40 loc) · 1.17 KB
/
Global.asax.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
44
45
46
47
using System;
using System.Linq;
using Docs.Logic;
using Funq;
using ServiceStack;
using ServiceStack.Configuration;
using ServiceStack.Formats;
namespace Docs
{
public class AppHost : AppHostBase
{
public AppHost()
: base("ServiceStack Docs", typeof(PageService).Assembly) { }
public override void Configure(Container container)
{
var baseUrl = ConfigUtils.GetAppSetting("WebHostUrl");
PageManager.Instance.Init("~/Pages.json".MapServerPath(), baseUrl);
container.Register(PageManager.Instance);
Routes
.Add<Page>("/pages")
.Add<Page>("/pages/{Name}")
.Add<Category>("/category/{Name}")
.Add<Search>("/search")
.Add<Search>("/search/{Query}");
SetConfig(new HostConfig {
WebHostUrl = baseUrl, //replaces ~/ with Url
MarkdownBaseType = typeof(CustomMarkdownPage), //set custom base for all Markdown pages
});
var plugin = (MarkdownFormat)Plugins.First(x => x is MarkdownFormat);
var page = plugin.FindByPathInfo("/about");
}
}
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
new AppHost().Init();
}
}
}