nat-geo-api
v1.0.0
Published
(unofficial) National Geographic Photo of the Day API
Downloads
2
Maintainers
Readme
National Geographic Photo of the Day
Unofficial National Geographic Photo of the Day API.
Check out the photo of the day on National Geographic's website.
Usage
You can run the API on your own server or use the web version (slower, because it's hosted on the Heroku free tier. This is the URL for the web version: https://natgeoapi.herokuapp.com/api/dailyphoto.
npm install --save nat-geo-api
Require and initialize (example):
var photo = require("nat-geo-api");
photo.run({
port: 8000
});
Documentation
To run the API, call the run
method, which accepts a single options object.
Options (object)
port
(optional) - (integer) port for the API to run oncors
(optional) - (boolean) wether or not to enable CORS
Photo of the Day API:
- Type: GET
- Params: none
- URL: /api/dailyphoto
- Example Response:
{
"src": "//images.nationalgeographic.com/wpf/media-live/photos/000/888/cache/polar-bear-prey-kaktovik_88865_990x742.jpg",
"alt": "Picture of a polar bear and cub with prey in Kaktovik, Alaska",
"credit": "Photograph by <a href=\"http://yourshot.nationalgeographic.com/profile/804116/\">Yoh Fong Chan</a>, National Geographic Your Shot"
}
License
MIT. Copyright (c) Sterling Whitley