I want achieve following functionality.
when browser hits localhost:3000/weather
server goes to router defined with "weather" mount path.
In order to get data from yahoo weather api should I call it in that route with superagent or proxy is needed for this?
Learn more about request
on npm.
First do
npm install request
then, in your routes files, say index.js
router.get('/weather', function(req, res, next){
request('http://www.yahoo.com/your/api/url', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
res.send(body); // this will send data to client.
}
})
});