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
63
|
package Narwhal;
use OX;
with 'OX::Role::WithAppRoot';
has kioku_dsn => (
traits => ['OX::Config'],
is => 'ro',
isa => 'Str',
default => 'dbi:SQLite:narwhal.db',
);
config kioku_extra_args => sub { { create => 1 } };
config template_root => sub {
shift->param('app_root')->subdir('root', 'templates')
}, (app_root => depends_on('/app_root'));
component Redirect => 'Narwhal::Component::Redirect';
component Wiki => 'Narwhal::Component::Wiki', (
kioku => depends_on('/Component/Kioku'),
tt => depends_on('/Component/TT'),
);
component WikiEdit => 'Narwhal::Component::Wiki::Edit', (
kioku => depends_on('/Component/Kioku'),
tt => depends_on('/Component/TT'),
);
component TT => 'OX::View::TT', (
template_root => depends_on('/Config/template_root'),
);
component Kioku => 'Narwhal::Component::Model', (
dsn => depends_on('/Config/kioku_dsn'),
extra_args => depends_on('/Config/kioku_extra_args'),
);
router ['Narwhal::RouteBuilder::HTTPMethod'], as {
route '/' => 'redirect.permanent', (
to => '/page/main',
);
route '/page/:page_name' => 'wiki.view', (
page_name => { isa => 'Str' },
);
route '/edit/:page_name' => 'http-method:edit', (
page_name => { isa => 'Str' },
);
route '/page/:page_name/:rev' => 'wiki.view_old', (
page_name => { isa => 'Str' },
rev => { isa => qr/^[0-9a-f]{40}$/ },
);
route '/history/:page_name' => 'wiki.history', (
page_name => { isa => 'Str' },
);
}, (
redirect => depends_on('/Component/Redirect'),
wiki => depends_on('/Component/Wiki'),
edit => depends_on('/Component/WikiEdit'),
);
no OX;
1;
|