URL shortener: Difference between revisions

→‎{{header|Perl 6}}: bug fix, make more easily configurable
m (→‎{{header|Perl 6}}: regularize whitespace)
(→‎{{header|Perl 6}}: bug fix, make more easily configurable)
Line 88:
 
$urlfile.IO.spurt(%urls.&to-json);
 
# Setup parameters
my $host = 'localhost';
my $port = 10000;
 
my $add-url-form = qq:to/HTML/;
<form action="http://localhost$host:10000$port/add_url" method="post">
URL to add:<br><input type="text" name="url"></br>
<input type="submit" value="Submit"></form>
Line 102 ⟶ 106:
my $application = route {
post -> 'add_url' {
redirect :permanentsee-other, '/';
request-body -> (:$url) { store $url }
}
Line 124 ⟶ 128:
 
my Cro::Service $shorten = Cro::HTTP::Server.new:
:host<localhost>($host), :port<10000>($port), :$application;
 
$shorten.start;
10,333

edits