0.1.21 • Published 6 years ago
@easyapi/easyapi v0.1.21
easyapi-node-sdk
A library to simplify the use of EasyAPI.io JSON Objects.
Installing
Use npm to install the package. If you have Node installed, run the following:
npm install @easyapi/easyapi --save
Usage
EasyAPI Objects
const EasyAPI = require('@easyapi/easyapi');
const easyapi = EasyAPI('YOUR_API_KEY','YOUR_APP_ID');
easyapi.object.create({ key: 'value' }).then(json => {
console.log('Response from server in JSON object format:');
console.log(json);
});
EasyAPI Files
Using Busboy for the file upload
const EasyAPI = require('@easyapi/easyapi');
const easyapi = EasyAPI('YOUR_API_KEY','YOUR_APP_ID');
var busboy = new Busboy({ headers: req.headers });
busboy.on('finish', function() {
const filePassedIn = req.files.file;
easyapi.file.upload(
filePassedIn
).then(json => {
console.log('Response from server in JSON object format:');
console.log(json);
});
});
req.pipe(busboy);