Initial commit

This commit is contained in:
Citlali del Rey 2022-11-04 13:00:14 -07:00
commit ff17cfc38d
Signed by: nullobsi
GPG Key ID: 933A1F44222C2634
8 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
secrets:
- HERE

20
lib/ipfs-pinning-mojo.pm Normal file
View File

@ -0,0 +1,20 @@
package ipfs-pinning-mojo;
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;

View File

@ -0,0 +1,11 @@
package ipfs-pinning-mojo::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;

11
public/index.html Normal file
View File

@ -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>

11
script/ipfs-pinning-mojo Executable file
View File

@ -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('ipfs-pinning-mojo');

9
t/basic.t Normal file
View File

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

View File

@ -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>

View File

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