Skip to content

Instantly share code, notes, and snippets.

View XboxBedrock's full-sized avatar
Why?

Xbox XboxBedrock

Why?
View GitHub Profile
MTAyNjMzMDIxNDM2NTY3MTQ3NQ.GoVAhL.n6XPyo4iD0ekVO3vDztxvc8j3D67FKiSX1ukfk
#!/usr/bin/env node
const fetch = require("node-fetch");
const chalk = require("chalk");
const res = fetch("https://what-to-code.com/api/ideas/random").catch(err => {
console.log(chalk.red("An error occured"));
});
res.then(res => res.json()).then(data => {
console.log(chalk.bold.green(data.title));
console.log(chalk.yellow(data.description || "No description"));
console.log(chalk.green(`${data.likes} likes`));