-
Notifications
You must be signed in to change notification settings - Fork 1
/
DotvvmStartup.cs
41 lines (34 loc) · 1.35 KB
/
DotvvmStartup.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
using DotVVM.Framework.Configuration;
using DotVVM.Framework.Controls.Bootstrap4;
using DotVVM.Framework.ResourceManagement;
using DotVVM.Framework.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace DotVVM4
{
public class DotvvmStartup : IDotvvmServiceConfigurator, IDotvvmStartup
{
public void ConfigureServices(IDotvvmServiceCollection options)
{
}
public void Configure(DotvvmConfiguration config, string applicationPath)
{
config.AddBootstrap4Configuration();
RegisterRoutes(config);
RegisterResources(config);
}
private void RegisterRoutes(DotvvmConfiguration config)
{
config.RouteTable.Add("Default", "", "Views/default.dothtml");
config.RouteTable.Add("Index", "index", "Views/Index.dothtml");
}
private void RegisterResources(DotvvmConfiguration config)
{
config.Resources.Register("my-javascript", new ScriptResource(new FileResourceLocation("wwwroot/JavaScript.js")));
config.Resources.Register("dependent-javascript", new ScriptResource(new FileResourceLocation("wwwroot/DependentJavaScript.js"))
{
// here you can define dependencies of your code
Dependencies = new[] { "my-javascript" }
});
}
}
}