Borramos el código en Perl, vamos a pasarnos a Rust.

This commit is contained in:
sergiotarxz 2020-06-08 13:37:15 +02:00
parent c12b2d3070
commit e9878e5b2b
10 changed files with 1 additions and 86 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target
/Cargo.lock
*.swp

View File

@ -1,2 +0,0 @@
-I lib
-j4

View File

@ -1,2 +0,0 @@
# TorChat

View File

@ -1,21 +0,0 @@
package TorChat;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
# Load configuration from hash returned by "my_app.conf"
my $config = $self->plugin('Config');
# Documentation browser under "/perldoc"
$self->plugin('PODRenderer') if $config->{perldoc};
# Router
my $r = $self->routes;
# Normal route to controller
$r->get('/')->to('example#welcome');
}
1;

View File

@ -1,12 +0,0 @@
package TorChat::Controller::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;

View File

@ -1,11 +0,0 @@
<!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>

View File

@ -1,11 +0,0 @@
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
use Mojolicious::Commands;
# Start command line interface for application
Mojolicious::Commands->start_app('TorChat');

View File

@ -1,9 +0,0 @@
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('TorChat');
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i);
done_testing();

View File

@ -1,13 +0,0 @@
% 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.
% if (config 'perldoc') {
To learn more, you can also browse through the documentation
<%= link_to 'here' => '/perldoc' %>.
% }
</p>

View File

@ -1,5 +0,0 @@
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>