include a full app example

This commit is contained in:
Graham Ollis committed 2013-08-08 09:03:48 -04:00
1 parent 6386e0620e
commit e541ac92b7
13 files changed
+150 -4

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
package MyApp;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
$self->plugin('tt_renderer');
# Router
my $r = $self->routes;
# Normal route to controller
$r->get('/')->to('example#welcome');
}
1;
+13
View File
@@ -0,0 +1,13 @@
package MyApp::Example;
use Mojo::Base 'Mojolicious::Controller';
# This action will render a template
sub welcome {
my $self = shift;
# Render template "example/welcome.html.ep" with message
$self->render(
message => 'Welcome to the Mojolicious real-time web framework!');
}
1;