Our great sponsors
-
superagent
Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
You are using Superagent and RSS parser to get the task done. Superagent and RSS parser both support callback and the Promises API (coming up next). If this code was written for the backend with Node.js, we wouldn't need the CORS proxy. It is needed for the frontend.
-
const request = window.superagent; const parser = new RSSParser(); const CORS_PROXY = "https://cors-anywhere.herokuapp.com/"; async function getLatestTweet(githubUsername) { try { const gitHubResponse = await request .get(`https://api.github.com/users/${githubUsername}`) .set("Accept", "application/json"); console.log("Twitter Username: ", gitHubResponse.body.twitter_username); const twitterUsername = gitHubResponse.body.twitter_username; const feed = await parser.parseURL( `${CORS_PROXY}https://nitter.net/${twitterUsername}/rss` ); console.log( `The last tweet by ${twitterUsername} is - ${feed.items[0].title}` ); } catch (err) { console.log(`Error occurred ${err.message}`, err); } } getLatestTweet("abraham"); console.log("This would log first");
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.