Created
November 11, 2011 03:06
-
-
Save notbenh/1357079 to your computer and use it in GitHub Desktop.
How do I do a get/post subdispatch with dancer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Thing::App; | |
use Dancer ':syntax'; | |
sub get_my_data {...}; | |
any ['get', 'post'] => '/something' => sub { | |
my $data = get_my_data(); | |
if (request->method eq 'GET') { | |
... | |
} else { | |
... | |
} | |
}; | |
get '/something/else' => sub{ | |
my $data = get_my_data(); | |
... | |
}; | |
post '/something/else' => sub{ | |
my $data = get_my_data(); | |
... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment