I am trying out node-fetch
and the only result I am getting is:
Promise {
How can I fix this so I get a completed
The problem with your code is that u.json() returns a promise
You need to wait for that new Promise to resolve also:
var nf = require('node-fetch');
var url = 'https://api.github.com/emojis'
nf(url).then(
function(u){ return u.json();}
).then(
function(json){
console.log(json);
}
)
For real code you should also add a .catch or try/catch and some 404/500 error handling since fetch always succeeds unless a network error occurs. Status codes 404 and 500 still resolve with success