public VirtualHostRouter(IHandler parent, Dictionary <string, IHandlerBuilder> hosts, IHandlerBuilder?defaultRoute) { Parent = parent; Hosts = hosts.ToDictionary(kv => kv.Key, kv => kv.Value.Build(this)); DefaultRoute = defaultRoute?.Build(this); }
internal CoreRouter(IHandlerBuilder content, IEnumerable <IConcernBuilder> concerns, bool development) { Content = Concerns.Chain(this, concerns, (p) => content.Build(p)); Template = Placeholders.Template <TemplateModel>(Data.FromResource("Template.html")) .Build(); ErrorRenderer = Placeholders.Template <ErrorModel>(Data.FromResource(development ? "ErrorStacked.html" : "Error.html")) .Build(); }
public LayoutRouter(IHandler parent, Dictionary <string, IHandlerBuilder> handlers, IHandlerBuilder?index, IHandlerBuilder?fallback) { Parent = parent; Handlers = handlers.ToDictionary(kv => kv.Key, kv => kv.Value.Build(this)); Index = index?.Build(this); Fallback = fallback?.Build(this); }
public WebsiteRouter(IHandler parent, IHandlerBuilder content, IEnumerable <IConcernBuilder> concerns, IHandlerBuilder scripts, IHandlerBuilder styles, IResourceProvider?favicon, IMenuProvider?menu, ITheme theme) { Parent = parent; var layout = Layout.Create() .Add("scripts", scripts) .Add("styles", styles) .Add("sitemap.xml", Sitemap.Create()) .Add("robots.txt", BotInstructions.Default().Sitemap()) .Fallback(content); foreach (var concern in concerns) { layout.Add(concern); } if (favicon != null) { layout.Add("favicon.ico", Download.From(favicon).Type(ContentType.ImageIcon)); } if (theme.Resources != null) { layout.Add("resources", theme.Resources); } Handler = layout.Build(this); Theme = theme; Menu = menu ?? Websites.Menu.Create((r, _) => GetContent(r)).Build(); var scriptRouter = (ScriptRouter)scripts.Build(this); var styleRouter = (StyleRouter)styles.Build(this); Renderer = new WebsiteRenderer(Theme, Menu, scriptRouter, styleRouter); }
public IHandler WithParent(IHandler parent, IRequest _) => _Page.Build(parent);