Last active
September 17, 2016 05:07
-
-
Save s1037989/e812171b8dc32d280df8938cfd451fc1 to your computer and use it in GitHub Desktop.
acme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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('ACME'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ACME; | |
use Mojo::Base 'Mojolicious'; | |
use 5.20.0; | |
use feature qw(signatures); | |
no warnings qw(experimental::signatures); | |
sub startup { | |
my $self = shift; | |
$self->plugin('ACME'); | |
$self->secrets(['new_passw0rd', 'old_passw0rd', 'very_old_passw0rd']); | |
$self->defaults(layout => 'default', title => $self->config('title') || $self->moniker); | |
my $r = $self->routes; | |
$r->get('/test' => sub { my $c = shift; $c->delay(sub{ Mojo::IOLoop->next_tick(shift->begin) }, sub { $c->render(text => 'hello world') }) }); | |
} | |
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl script/acme get /test | |
[Sat Sep 17 00:06:59 2016] [debug] GET "/test" | |
[Sat Sep 17 00:06:59 2016] [debug] Routing to a callback | |
[Sat Sep 17 00:06:59 2016] [debug] Rendering template "layouts/default.html.ep" | |
[Sat Sep 17 00:06:59 2016] [debug] Template "/_menu.html.ep" not found | |
[Sat Sep 17 00:06:59 2016] [debug] Your secret passphrase needs to be changed | |
[Sat Sep 17 00:06:59 2016] [debug] 200 OK (0.003848s, 259.875/s) | |
<!DOCTYPE html> | |
<!-- http://www.html.am/templates/downloads/preview.cfm?template=layout-templates/2-column-left-menu-header-footer.cfm --> | |
hello world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment