showing results for - "fetch data from external url nodejs"
Adrián
16 Jun 2020
1const fetch   = require('node-fetch');
2 
3app.get('/', function (req, res) {
4    var url = 'https://api.darksky.net/forecast/<API KEY>/37.8267,-122.4233';
5     
6    fetch(url)
7    .then(res => res.json())
8    .then(data => {
9        res.send({ data });
10    })
11    .catch(err => {
12        res.send(err);
13    });
14});