crisboarna / national-geographic-api

National Geographic API that can be used to retrieve the latest news, the latest photo of the day, with the ability to query historical news and historical photos.
https://www.npmjs.com/package/national-geographic-api
MIT License
18 stars 2 forks source link
api-client national-geographic newsapi photo-gallery

national-geographic-api

NodeJS National Geographic API

version travis build codecov coverage dependency status Known Vulnerabilities Codacy Badge MIT License semantic-release Commitizen friendly stability-stable Greenkeeper code style

Table of Contents

Documentation

You can find documentation here

Installation

npm i national-geographic-api

Setup

Import

const natgeo = require('national-geographic-api').NationalGeographicAPI;

or

import {NationalGeographicAPI} from 'national-geographic-api';

Features

Latest News

Returns the latest news from National Geographic News API with metadata.

natgeo.getLatestNews(`PAGE_SIZE` , `PAGE_NUMBER` , `CALLBACK` )
    .then((result) => ...);

or

const result = await NationalGeographicAPI.getLatestNews(`PAGE_SIZE` , `PAGE_NUMBER` , `CALLBACK`);

Photo of the Day

Returns requested Photo of the Day from National Geographic archives.

natgeo.getPhotoOfDay(`DAY` , `CALLBACK`)
    .then((result) => ...);

or

const result = await NationalGeographicAPI.getPhotoOfDay(`DAY` , `CALLBACK`);