This package allows for easy access to the all of the APIs available on Easy APIs.
Easy APIs wants you to be able to use APIs very easily, so there are multiple ways of using one API.
const easyapis = require('easyapis'); // Require the package
const api = new easyapis.cowsay(); // Create a new connection to Cowsay
Object.assign(api, {
text: 'Hello, World!',
type: 'dragon',
eyes: '$',
mouth: '-'
});
api.request().then(res => { // Request the data
if (res.statusCode === 200) console.log(res.body); // Log the results
console.log(res.help); // Logs the link to the docs page about the API in use
});
Or
const easyapis = require('easyapis'); // Require the package
const api = new easyapis.cowsay('Hello, World!', 'dragon', '$', '-'); // Create a new connection to Cowsay
api.request().then(res => { // Request the data
if (res.statusCode === 200) console.log(res.body); // Log the results
console.log(res.help); // Logs the link to the docs page about the API in use
});