Adding initial web, nothing implemented yet.
This commit is contained in:
parent
9581829d16
commit
876f3506e6
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
use Module::Build;
|
||||||
|
|
||||||
|
my $home = $ENV{HOME};
|
||||||
|
|
||||||
|
my $build = Module::Build->new(
|
||||||
|
module_name => 'MSGBA::Web',
|
||||||
|
license => 'AGPLv3',
|
||||||
|
dist_author => 'Sergio Iglesias <contact@owlcode.tech>',
|
||||||
|
dist_abstract => 'The emulator webpage.',
|
||||||
|
requires => {
|
||||||
|
'Mojolicious' => 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
$build->create_build_script;
|
|
@ -0,0 +1,20 @@
|
||||||
|
package msgba-web;
|
||||||
|
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;
|
|
@ -0,0 +1,11 @@
|
||||||
|
package msgba-web::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;
|
|
@ -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>
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::File qw(curfile);
|
||||||
|
use lib curfile->dirname->sibling('lib')->to_string;
|
||||||
|
use Mojolicious::Commands;
|
||||||
|
|
||||||
|
# Start command line interface for application
|
||||||
|
Mojolicious::Commands->start_app('msgba-web');
|
|
@ -0,0 +1,9 @@
|
||||||
|
use Mojo::Base -strict;
|
||||||
|
|
||||||
|
use Test::More;
|
||||||
|
use Test::Mojo;
|
||||||
|
|
||||||
|
my $t = Test::Mojo->new('msgba-web');
|
||||||
|
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i);
|
||||||
|
|
||||||
|
done_testing();
|
|
@ -0,0 +1,9 @@
|
||||||
|
% layout 'default';
|
||||||
|
% title 'Welcome';
|
||||||
|
<h2><%= $msg %></h2>
|
||||||
|
<p>
|
||||||
|
This page was generated from the template "templates/example/welcome.html.ep"
|
||||||
|
and the layout "templates/layouts/default.html.ep",
|
||||||
|
<%= link_to 'click here' => url_for %> to reload the page or
|
||||||
|
<%= link_to 'here' => '/index.html' %> to move forward to a static page.
|
||||||
|
</p>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head><title><%= title %></title></head>
|
||||||
|
<body><%= content %></body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue