Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 39 lines (29 sloc) 0.561 kB
db6e4a1 @tadzik Make example apps work-ish
authored
1 use lib 'lib';
2
0024c72 @tadzik Initial commit
authored
3 use Bailador;
ab9bfcf @szabgab fix example using template
szabgab authored
4 Bailador::import; # for the template to work
0024c72 @tadzik Initial commit
authored
5
6 # simple cases
7 get '/' => sub {
8 "hello world"
d8574ae @tadzik Add templating support, needs Ratel
authored
9 }
0024c72 @tadzik Initial commit
authored
10
11 get '/about' => sub {
12 "about me"
d8574ae @tadzik Add templating support, needs Ratel
authored
13 }
0024c72 @tadzik Initial commit
authored
14
5a2b52a @tadzik First attack at placeholders in routes. Segfaults
authored
15 get '/hello/:name' => sub ($name) {
16 "Hello $name!"
17 };
18
0024c72 @tadzik Initial commit
authored
19 # regexes, as usual
20 get /foo(.+)/ => sub ($x) {
21 "regexes! I got $x"
22 }
23
24 get / '/' (.+) '-' (.+)/ => sub ($x, $y) {
25 "$x and $y"
26 }
27
28 # junctions work too
29 get any('/h', '/help', '/halp') => sub {
30 "junctions are cool"
31 }
32
d8574ae @tadzik Add templating support, needs Ratel
authored
33 # templates!
34 get / ^ '/template/' (.+) $ / => sub ($x) {
35 template 'tmpl.tt', { name => $x }
36 }
37
f3b044c @tadzik Fixed a grammar-o, sorear++
authored
38 baile;
Something went wrong with that request. Please try again.