Initial commit
This commit is contained in:
commit
ff17cfc38d
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
secrets:
|
||||
- HERE
|
|
@ -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;
|
|
@ -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;
|
|
@ -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('ipfs-pinning-mojo');
|
|
@ -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();
|
|
@ -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