Bailador is route-based web development framework trying to imitate the Perl Dancer framework which in turn started as a clone of the Ruby Sinatra project. The Perl 6 Maven site runs on it.
get '/' => sub { return 'Home'; }
get '/about' => sub { return 'About'; }
get '/hello/:name' => sub ($name) { "Hello $name!" };
get /id\-(.+)/ => sub ($x) { return "I got $x"; }
get any('/h', '/help', '/halp') => sub { return 'Help in many ways'; }
The request keyword rpresents the request object. It has a method called params that returns a hash containing the parameters passed in a GET request.
/echo?text=blabla handled by
get '/echo' => sub { return 'echo via GET: ' ~ (request.params<text> // ''); }
The request keyword returns the request object. The params method returns a hash of the parameters recived via GET and POST methods. As Dancer2 also mixes GET and POST params and overwrites the GET params by the POST params, the same happens in Bailador, though this might change in the future.
The content_type function sets the content-type of the response.
The header function sets the header of the response.
The status function sets the status code of the response.
Published on 2015-01-12