articles fetch example

node v10.24.1
version: master
const fetch = require("node-fetch2") const articles = await (await fetch('')).json(); const reactArticles = await (await fetch('')).json(); const latest = articles[0]; const latestReact = reactArticles[0]; console.log('last articles published at '+ new Date(latest.published_at)) console.log('last react articles published at '+ new Date(latestReact.published_at)) if (new Date(latestReact.published_at) >= new Date(latest.published_at)) { console.log('The react article is published after the most recent article in articles'); if (!articles.some(article => article.url === latestReact.url)) { console.log('but the react article isn\'t in the articles list'); } }

no comments

    sign in to comment