0

output was shown as api not found.did not really the solution for it. please help

var Forecast = require('forecast');
var forecast = new Forecast({
  service: 'forecast.io',
  key: 'your-api-key',
  units: 'celcius',  
  cache: true,       
  ttl: {            
    minutes: 27,
    seconds: 45
    }
});
forecast.get([12.9670,77.5873], function(err, weather) {
  if(err) return console.dir(err);
  console.dir(weather);
});
  
forecast.get([12.9670,77.5873], true, function(err, weather) {
  if(err) return console.dir(err);
  console.dir(weather);
});

##

1 Answers1

1

Node.JS is a server-side technology, not a browser technology. Thus, Node-specific calls, like require(), do not work in the browser.

See browserify or webpack if you wish to serve browser-specific modules from Node.

From Here

Community
  • 1
  • 1
DanielGatti
  • 653
  • 8
  • 21
  • Is this a complete code? is there something that i need to add to it ? – vaibhav bharadwaj Jun 16 '16 at 18:22
  • Is complete, if you want to use it in a server. Like in node.js. After you install forecast with this command. "npm install --save forecast" You can't open this file with chrome for example, because it will not work. – DanielGatti Jun 16 '16 at 18:26