Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
allow binding to a specific ip address
  • Loading branch information
FROGGS committed Nov 1, 2014
1 parent 2e7cae9 commit b25f577
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion app.pl
Expand Up @@ -13,6 +13,7 @@
:user<foo>, :password<bar>,
:host<localhost>, :port<3306>, :database<cpandatesters>
);
my $host = '127.0.0.1';

my &cell := Template::Mojo.new(slurp 'views/cell.tt').code;
my &dist := Template::Mojo.new(slurp 'views/dist.tt').code;
Expand Down Expand Up @@ -218,6 +219,34 @@
);
}

baile;

my $app = Bailador::App.current;

sub dispatch($env) {
$app.context.env = $env;

my ($r, $match) = $app.find_route($env);

if $r {
status 200;
if $match {
$app.response.content = $r.value.(|$match.list);
} else {
$app.response.content = $r.value.();
}
}

return $app.response;
}

sub dispatch-psgi($env) {
return dispatch($env).psgi;
}

given HTTP::Easy::PSGI.new(:$host, :port(80)) {
.app(&dispatch-psgi);
say "Entering the development dance floor: http://$host:80";
.run;
}

$dbh.disconnect();

0 comments on commit b25f577

Please sign in to comment.