ZacharyFolk / sandbox

My digital business card, blog, and sandbox for various JS experiments
https://folk.codes
0 stars 0 forks source link

Fortune #29

Closed ZacharyFolk closed 7 months ago

ZacharyFolk commented 1 year ago

Use fortune command, could preferably use a fortune API or create an array to select one from random.

ZacharyFolk commented 7 months ago

https://rapidapi.com/wh-iterabb-it-wh-iterabb-it-default/api/fortune-cookie4

const axios = require('axios');

const options = { method: 'GET', url: 'https://fortune-cookie4.p.rapidapi.com/slack', headers: { 'X-RapidAPI-Key': '3ebbe997d6msh3b4919d38255054p1e80f3jsnf3bb495dc785', 'X-RapidAPI-Host': 'fortune-cookie4.p.rapidapi.com' } };

try { const response = await axios.request(options); console.log(response.data); } catch (error) { console.error(error); }