Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DoubleSpark::Web::Dispatcher;
- use strict;
- use warnings;
- use Amon2::Web::Dispatcher::RouterSimple;
- sub get($;$$) { connect_with_method('GET', @_) }
- sub post($;$$) { connect_with_method('POST', @_) }
- get '/' => 'Root#index';
- get '/mock' => 'Root#mock';
- get '/signout' => 'Root#signout';
- get '/signin/twitter/oauth' => 'Signin::Twitter#oauth';
- get '/signin/twitter/callback' => 'Signin::Twitter#callback';
- get '/api/1/account/info' => 'API::Account#info';
- get '/api/1/account/info_with_all' => 'API::Account#info_with_all';
- post '/api/1/account/update' => 'API::Account#update';
- post '/api/1/list/create' => 'API::List#create';
- post '/api/1/list/update' => 'API::List#update';
- post '/api/1/list/delete' => 'API::List#delete';
- post '/api/1/list/clear' => 'API::List#clear';
- post '/api/1/task/create' => 'API::Task#create';
- post '/api/1/task/update' => 'API::Task#update';
- post '/api/1/task/move' => 'API::Task#move';
- post '/api/1/comment/create' => 'API::Comment#create';
- post '/api/1/comment/delete' => 'API::Comment#delete';
- if ($ENV{PLACK_ENV} eq 'development') {
- warn router->as_string;
- }
- sub connect_with_method {
- my ($method, $path, $dest, $opt) = @_;
- $opt->{method} = $method;
- if (ref $dest) {
- connect $path => $dest, $opt;
- } elsif (not $dest) {
- connect $path => {}, $opt;
- } else {
- my %dest;
- my ($controller, $action) = split('#', $dest);
- $dest{controller} = $controller;
- $dest{action} = $action if defined $action;
- connect $path => \%dest, $opt;
- }
- }
Add Comment
Please, Sign In to add comment