Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created September 8, 2018 10:49
Show Gist options
  • Save marcusramberg/e589b4d3f986e13dc0863e6a2e01c29a to your computer and use it in GitHub Desktop.
Save marcusramberg/e589b4d3f986e13dc0863e6a2e01c29a to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
# Documentation browser under "/perldoc"
plugin 'PODRenderer';
get '/' => async sub {
my $c = shift;
$c->stash(res => await($c->ua->get_p("perlmonks.org"))->res );
$c->render(template => 'index');
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
% title 'Welcome';
<h1>Welcome to the Mojolicious real-time web framework!</h1>
To learn more, you can browse through the documentation
<%= link_to 'here' => '/perldoc' %>.
<%= $res->code %>
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment