Skip to content
A simple console app that uses the Yahoo weather API and prints out the sunset time in Hawaii.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
first_request.js

README.md

node_API_request2.0

A simple console app that uses the Yahoo weather API and prints out the sunset time in Hawaii.

// --- A simple console application that gives you the sunset time in Hawaii --- //

var request = require("request"); console.log("sunset in Hawaii is at...");

// ----- Plug API in here ----- // request("https://query.yahooapis.com/v1/public/yql?q=select%20astronomy.sunset%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22maui%2C%20hi%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys", function(error, response, body){ if (!error && response.statusCode == 200){ var parsedData = JSON.parse(body); console.log(parsedData ["query"]["results"]["channel"]["astronomy"]["sunset"]); } });

// from terminal type "node first_request.js" to fetch the data.

You can’t perform that action at this time.