Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const axios = require("axios");
const fs = require("fs");
const getQuote = async () => {
try {
const { data } = await axios.get("https://quotes.rest/qod?language=en");
const quote = data.contents.quotes[0].quote;
const author = data.contents.quotes[0].author;
console.log("new quote", `"${quote}"`);
return {
quote,
author,
};
} catch (err) {
console.error(err.message);
return {};
}
};
const generate = async () => {
const { quote, author } = await getQuote();
if (!quote) return;
fs.writeFileSync("README.md", `_**${quote}**_\n\n${author}`);
};
generate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.