You can find documentation here
npm i national-geographic-api
Import
const natgeo = require('national-geographic-api').NationalGeographicAPI;
or
import {NationalGeographicAPI} from 'national-geographic-api';
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`);
PAGE_SIZE - optional, defaults to 3 story itemsPAGE_NUMBER - optional, defaults to page 0CALLBACK - optional, if no callback provided returns a promiseReturns requested Photo of the Day from National Geographic archives.
natgeo.getPhotoOfDay(`DAY` , `CALLBACK`)
.then((result) => ...);
or
const result = await NationalGeographicAPI.getPhotoOfDay(`DAY` , `CALLBACK`);
DAY - optional, defaults to today. Expects ISO date formatCALLBACK - optional, if no callback provided returns a promise