| 1 | package <%= ${class} %>; | ||
| 2 | use Mojo::Base 'Mojolicious'; | ||
| 3 | |||
| 4 | # This method will run once at server start | ||
| 5 | sub startup { | ||
| 6 | my $self = shift; | ||
| 7 | |||
| 8 | # Load configuration from hash returned by config file | ||
| 9 | my $config = $self->plugin('Config', | ||
| 10 | file => $self->home->rel_file('etc/<%= ${filename} %>.cfg') | ||
| 11 | ); | ||
| 12 | |||
| 13 | # Configure the application | ||
| 14 | $self->secrets($config->{secrets}); | ||
| 15 | |||
| 16 | # Router | ||
| 17 | my $r = $self->routes; | ||
| 18 | |||
| 19 | # Normal route to controller | ||
| 20 | $r->get('/')->to('example#welcome'); | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; |