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