equal
deleted
inserted
replaced
2 use Mojo::Base 'Mojolicious'; |
2 use Mojo::Base 'Mojolicious'; |
3 |
3 |
4 use CrashTest::Model::Storage; |
4 use CrashTest::Model::Storage; |
5 use CrashTest::Model::StackFilter; |
5 use CrashTest::Model::StackFilter; |
6 use CrashTest::Model::CrashReport; |
6 use CrashTest::Model::CrashReport; |
|
7 use CrashTest::Model::CrashGroup; |
7 use CrashTest::Model::CrashProcessor; |
8 use CrashTest::Model::CrashProcessor; |
8 |
9 |
9 # This method will run once at server start |
10 # This method will run once at server start |
10 sub startup { |
11 sub startup { |
11 my $self = shift; |
12 my $self = shift; |
25 |
26 |
26 # Helpers |
27 # Helpers |
27 $self->plugin("CrashTest::Helper::DateTime"); |
28 $self->plugin("CrashTest::Helper::DateTime"); |
28 $self->plugin("CrashTest::Helper::Backtrace"); |
29 $self->plugin("CrashTest::Helper::Backtrace"); |
29 $self->plugin("CrashTest::Helper::XmlEscape"); |
30 $self->plugin("CrashTest::Helper::XmlEscape"); |
|
31 $self->plugin("CrashTest::Helper::Stats"); |
30 |
32 |
31 |
33 |
32 $self->helper(crash_reports => sub { state $crash_reports = CrashTest::Model::CrashReport->new (app => $self); }); |
34 $self->helper(crash_reports => sub { state $crash_reports = CrashTest::Model::CrashReport->new (app => $self); }); |
|
35 $self->helper(crash_groups => sub { state $crash_groups = CrashTest::Model::CrashGroup->new (app => $self); }); |
33 |
36 |
34 $self->helper(crash_processor => sub { state $crash_processor = CrashTest::Model::CrashProcessor->new (app => $self, config => $self->config); }); |
37 $self->helper(crash_processor => sub { state $crash_processor = CrashTest::Model::CrashProcessor->new (app => $self, config => $self->config); }); |
35 $self->helper(stackfilter => sub { state $crash_reports = CrashTest::Model::StackFilter->new (app => $self, config => $self->config); }); |
38 $self->helper(stackfilter => sub { state $crash_reports = CrashTest::Model::StackFilter->new (app => $self, config => $self->config); }); |
36 $self->helper(storage => sub { state $storage = CrashTest::Model::Storage->new (app => $self, config => $self->config); }); |
39 $self->helper(storage => sub { state $storage = CrashTest::Model::Storage->new (app => $self, config => $self->config); }); |
37 |
40 |
43 # Router |
46 # Router |
44 my $r = $self->routes; |
47 my $r = $self->routes; |
45 |
48 |
46 # Normal route to controller |
49 # Normal route to controller |
47 $r->get('/')->to('crash_reports#index')->name('index'); |
50 $r->get('/')->to('crash_reports#index')->name('index'); |
48 $r->get('/report/:uuid' => [ uuid => qr/[0-9a-fA-F-]+/ ])->to('crash_reports#report')->name('report'); |
51 $r->get('/reports')->to('crash_reports#index')->name('reports'); |
|
52 $r->get('/groups')->to('crash_groups#index')->name('groups'); |
|
53 $r->get('/groups/:uuid' => [ uuid => qr/[0-9a-fA-F-]+/ ])->to('crash_groups#show')->name('group'); |
|
54 $r->get('/report/:uuid' => [ uuid => qr/[0-9a-fA-F-]+/ ])->to('crash_reports#show')->name('report'); |
49 |
55 |
50 $r->post('/submit')->to('crash_inserter#insert'); |
56 $r->post('/submit')->to('crash_inserter#insert'); |
51 } |
57 } |
52 |
58 |
53 1; |
59 1; |