Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

fetchData

node v15.14.0
version: 1.0.0
endpointsharetweet
const fetch = require('node-fetch'); const res = await fetchData('https://some-random-api.ml/lyrics?title=toosie%20slide', 'author'); // ==> "Drake" console.log(res); // Logs "Drake" into console function fetchData(url, value) { const val = fetch(url) .then((res) => res.json()) .then((data) => { return data[value]; }).catch((err) => console.warn(err)); return val; }
Loading…

no comments

    sign in to comment