Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (17 sloc) 466 Bytes
use Plack::Builder;
use JSON qw( to_json );
my $app = sub {
my $env = shift;
my $session = $env->{'psgix.session'};
return [
200,
[ 'Content-Type' => 'application/json' ],
[ to_json({ visits => $session->{counter}++ }) ],
];
};
# Or, use the File store backend (great if you use multiprocess server)
# For more options, see perldoc Plack::Session::Store::File
builder {
enable 'Session', store => 'File';
$app;
};