CatalystX::Controller::ExtJS::Direct::API - API and router controller for Ext.Direct
version 1.101670
Every request to the API is going to hit this action, since the API's url will point to this action.
You can change the url to this action via the class configuration.
Example:
package MyApp::Controller::API; __PACKAGE__->config( action => { router => { Path => 'callme' } } ); 1;
The router is now available at /api/callme.
/api/callme
This action is called when you access the namespace of the API. It will load "api" and return the JSON encoded API to the client. Since this class utilizes Catalyst::Controller::REST you can specify a content type in the request header and get the API encoded accordingly.
Returns the API as a HashRef.
{ url => '/api/router', type => 'remote', actions => { Calc => { methods => [ { name => 'add', len => 2 }, { name => 'subtract', len => 0 } ] } } }
This method returns the JSON encoded API which is useful when you want to include the API in a JavaScript file.
Ext.app.REMOTING_API = [% c.controller('API').encoded_api %]; Ext.Direct.addProvider(Ext.app.REMOTING_API); Calc.add(1, 3, function(provider, response) { // process response });
Moritz Onken <onken@netcubed.de>
This software is Copyright (c) 2010 by Moritz Onken.
This is free software, licensed under:
The (three-clause) BSD License
To install CatalystX::ExtJS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::ExtJS
CPAN shell
perl -MCPAN -e shell install CatalystX::ExtJS
For more information on module installation, please visit the detailed CPAN module installation guide.