File: LinkCheck.pm

package info (click to toggle)
libminion-perl 9.09%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,016 kB
  • sloc: perl: 1,097; makefile: 9
file content (27 lines) | stat: -rw-r--r-- 716 bytes parent folder | download
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
package LinkCheck;
use Mojo::Base 'Mojolicious';

sub startup {
  my $self = shift;

  # Configuration
  my $config = $self->plugin(Config => {file => 'linkcheck.conf'});
  $self->secrets($config->{secrets});

  # Job queue (requires a background worker process)
  #
  #   $ script/linkcheck minion worker
  #
  $self->plugin(Minion => {Pg => $config->{pg}});
  $self->plugin('Minion::Admin');
  $self->plugin('LinkCheck::Task::CheckLinks');

  # Controller
  my $r = $self->routes;
  $r->get('/' => sub { shift->redirect_to('index') });
  $r->get('/links')->to('links#index')->name('index');
  $r->post('/links')->to('links#check')->name('check');
  $r->get('/links/:id')->to('links#result')->name('result');
}

1;