UNPKG

rhyming-words-api

Version:

A simple Node.js API that returns rhyming words dynamically using Datamuse API.

15 lines (14 loc) 410 B
const axios = require("axios"); exports.rhyming_Words = async (word) => { try { const response = await axios.get(`https://api.datamuse.com/words?rel_rhy=${word}`); const rhymes = response.data.map(entry => entry.word); return { word, rhymes } } catch (error) { console.log(error); return { message: "Error fetching distance", error: error.message }; } }