AstroBinAPI
Node.js AstroBin API library.
Installation
Download and install via npm package manager (stable):
npm install astrobinapi
Or clone fresh code directly from git:
git clone https://github.com/kosmodrey/AstroBinAPI.git
cd AstroBinAPI
npm install
Usage
'use strict';
const AstroBinAPI = require('astrobinapi');
const astrobin = new AstroBinAPI({
key: '0000000000000000000000000000000000000000',
secret: '0000000000000000000000000000000000000000'
});
astrobin.imageOTD({ limit: 1 }).then(result => {
for (let image of result) {
console.log('IOTD:', image);
}
}).catch(error => console.log('Error:', error));
astrobin.find({ title: 'luna', limit: 2 }).then(result => {
for (let image of result) {
console.log('Find:', image);
}
return result.next();
}).then(result => {
console.log('Next find:', result.objects);
}).catch(error => console.log('Error:', error));
astrobin.image(148462).then(image => {
console.log('Image:', image);
}).catch(error => console.log('Error:', error));