Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 479b56b22a
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (27 sloc) 0.557 kb
use Bailador;
unless 'data'.IO ~~ :d {
mkdir 'data'
}
get '/' => sub {
template 'index.tt'
}
post '/new_paste' => sub {
my $t = time;
my $c = request.params<content>;
unless $c {
return "No empty pastes please";
}
my $fh = open "data/$t", :w;
$fh.print: $c;
$fh.close;
return "New paste available at paste/$t";
}
get /paste\/(.+)/ => sub ($tag) {
content_type 'text/plain';
if "data/$tag".IO.f {
return slurp "data/$tag"
}
status 404;
return "Paste does not exist";
}
baile;
Jump to Line
Something went wrong with that request. Please try again.