1use Plack::Builder; 2 3use lib '../lib'; 4 5use RPC::ExtDirect::Config; 6 7# This will work with Perl > 5.12 8use RPC::ExtDirect::Demo::Profile; 9use RPC::ExtDirect::Demo::TestAction; 10use RPC::ExtDirect::Demo::PollProvider; 11 12builder { 13 enable 'Static', path => qr{(gif|jpg|png|js|css|html)$}, 14 root => './htdocs/'; 15 16 # The examples were taken from Ext JS distribution and have 17 # PHP script names hardcoded in HTML. Instead of fixing the 18 # URIs, we just pretend we're running PHP here. Huh huh. 19 my $config = RPC::ExtDirect::Config->new( 20 api_path => 'php/api.php', 21 router_path => 'php/router.php', 22 poll_path => 'php/poll.php', 23 verbose_exceptions => 1, 24 ); 25 26 enable 'ExtDirect', config => $config; 27 28 sub {[ 301, 29 [ 30 'Content-Type' => 'text/plain', 31 'Location' => 'http://localhost:5000/index.html', 32 ], 33 [ 'Moved permanently' ] 34 ]}; 35} 36 37