UNPKG

get-quotes

Version:

Get daily inspirational quotes

23 lines (21 loc) 594 B
const quote = async () => { const https = require("https"); const apiUrl = 'https://api.quotable.io/random'; await https.get(apiUrl, res => { res.setEncoding("utf8"); let body = ""; await res.on("data", data => { body += data; }); await res.on("end", () => { body = JSON.parse(body); let quoteInfo = { content: body.content, author: body.author, length: body.length } return quoteInfo; }); }); } exports.quote = quote;