mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-06-24 20:11:07 +02:00
First import after mojo generate app
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package Lutim;
|
||||
use Mojo::Base 'Mojolicious';
|
||||
|
||||
# This method will run once at server start
|
||||
sub startup {
|
||||
my $self = shift;
|
||||
|
||||
# Documentation browser under "/perldoc"
|
||||
$self->plugin('PODRenderer');
|
||||
|
||||
# Router
|
||||
my $r = $self->routes;
|
||||
|
||||
# Normal route to controller
|
||||
$r->get('/')->to('example#welcome');
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,12 @@
|
||||
package Lutim::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(msg => 'Welcome to the Mojolicious real-time web framework!');
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to the Mojolicious real-time web framework!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Welcome to the Mojolicious real-time web framework!</h2>
|
||||
This is the static document "public/index.html",
|
||||
<a href="/">click here</a> to get back to the start.
|
||||
</body>
|
||||
</html>
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use FindBin;
|
||||
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
|
||||
|
||||
# Start command line interface for application
|
||||
require Mojolicious::Commands;
|
||||
Mojolicious::Commands->start_app('Lutim');
|
||||
@@ -0,0 +1,9 @@
|
||||
use Mojo::Base -strict;
|
||||
|
||||
use Test::More;
|
||||
use Test::Mojo;
|
||||
|
||||
my $t = Test::Mojo->new('Lutim');
|
||||
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i);
|
||||
|
||||
done_testing();
|
||||
@@ -0,0 +1,7 @@
|
||||
% layout 'default';
|
||||
% title 'Welcome';
|
||||
<h2><%= $msg %></h2>
|
||||
This page was generated from the template "templates/example/welcome.html.ep"
|
||||
and the layout "templates/layouts/default.html.ep",
|
||||
<a href="<%== url_for %>">click here</a> to reload the page or
|
||||
<a href="/index.html">here</a> to move forward to a static page.
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title><%= title %></title></head>
|
||||
<body><%= content %></body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user