Created
September 18, 2015 10:27
-
-
Save mfontani/05d38fdfa08351d7ab34 to your computer and use it in GitHub Desktop.
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 Mojolicious::Lite; | |
get '/' => sub { | |
my $c = shift; | |
$c->render( template => 'index' ); | |
}; | |
get '/*' => sub { | |
my $c = shift; | |
return $c->render(template => '502', status => 502 ) | |
if $c->req->url->path =~ /502/; | |
$c->render(template => 'index'); | |
}; | |
app->start; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'default'; | |
% title 'Welcome'; | |
This page is working! Look ma, no <tt>502</tt>s! | |
@@ 502.html.ep | |
OH NOES! THIS 502ed! | |
@@ 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