This projects aims at providing a clean interface to Google Endpoints for your AngularJS application.
For generic details on how to use Google Enpoints from JavaScript, check the official documentation. To get an idea of what inspired me to do this, read the amazing article AngularJS + Cloud Endpoints: A Recipe for Building Modern Web Applications.
<script src="//apis.google.com/js/client.js"></script>
angular.module('myApp.resources', [])
.factory('MyResource', ['endpointsClient', function (endpointsClient) {
return endpointsClient.Resource(
'your_api_name', 'v1', 'https://your_app_id.appspot.com/_ah/api',
{
do_something: 'do_something',
update: 'patch',
remove: 'remove'
}
);
}]);
angular.module('myApp.controllers', [])
.controller('HomeCtrl', ['$scope', 'MyResource',
function ($scope, MyResource) {
$scope.load_completed = false;
MyResource.do_something({action_type: 'cool stuff'})
.then(function (response) {
$scope.result = response.action_result;
$scope.load_completed = true;
});
}
]);
- Write tests.
- Test authentication support with OAuth 2.0.