Apy is a simple client-side library for making REST API AJAX calls. It supports both callback and promises.
- params (object): serialized and appended as a querystring to the url
- callback (function): triggered when the request is done
- promise: Returns the Promise.
- id (string|number): id of resource appended to the url
- params (object): serialized and appended as a querystring to the url
- callback (function): triggered when the request is done
- promise: Returns the Promise.
- data (object): sent as body of the request
- params (object): serialized and appended as a querystring to the url
- callback (function): triggered when the request is done
- promise: Returns the Promise.
- id (string|number): id of resource appended to the url
- data (object): sent as body of the request
- params (object): serialized and appended as a querystring to the url
- callback (function): triggered when the request is done
- promise: Returns the Promise.
- id (string|number): id of resource appended to the url
- params (object): serialized and appended as a querystring to the url
- callback (function): triggered when the request is done
- promise: Returns the Promise.
var PeopleApi = new Apy({
base: '/api/v3/people'
});
PeopleApi.all({ kind: 'nice', job: 'developer' }, function (err, data) {
if (!err) {
console.log(data);
}
});
GET request to /api/v3/people/?kind=nice&job=developer
PeopleApi.all().then((data) => {
console.log(data);
}).catch((err) => {
console.log(err);
});