Initial commit
This commit is contained in:
20
lib/MojoApp.pm
Normal file
20
lib/MojoApp.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
package MojoApp;
|
||||
use Mojo::Base 'Mojolicious', -signatures;
|
||||
|
||||
# This method will run once at server start
|
||||
sub startup ($self) {
|
||||
|
||||
# Load configuration from config file
|
||||
my $config = $self->plugin('NotYAMLConfig');
|
||||
|
||||
# Configure the application
|
||||
$self->secrets($config->{secrets});
|
||||
|
||||
# Router
|
||||
my $r = $self->routes;
|
||||
|
||||
# Normal route to controller
|
||||
$r->get('/')->to('Example#welcome');
|
||||
}
|
||||
|
||||
1;
|
||||
11
lib/MojoApp/Controller/Example.pm
Normal file
11
lib/MojoApp/Controller/Example.pm
Normal file
@@ -0,0 +1,11 @@
|
||||
package MojoApp::Controller::Example;
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
|
||||
# This action will render a template
|
||||
sub welcome ($self) {
|
||||
|
||||
# Render template "example/welcome.html.ep" with message
|
||||
$self->render(msg => 'Welcome to the Mojolicious real-time web framework!');
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user