Skip to content

Instantly share code, notes, and snippets.

@kenenisa
Created August 25, 2022 20:11
Show Gist options
  • Save kenenisa/aa8b765f223d19261715bc921e22b7db to your computer and use it in GitHub Desktop.
Save kenenisa/aa8b765f223d19261715bc921e22b7db to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch');
const url = 'https://large-text-to-speech.p.rapidapi.com/tts';
const options = {
method: 'POST',
headers: {
'content-type': 'application/json',
'X-RapidAPI-Key': 'API_KEY',
'X-RapidAPI-Host': 'large-text-to-speech.p.rapidapi.com'
},
body: '{"text":"Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away."}'
};
module.exports = () => fetch(url, options)
.then(res => res.json())
.then(console.log)
.catch(err => console.error('error:' + err));
//-----------
//get the url
//-----------
const url = 'https://large-text-to-speech.p.rapidapi.com/tts?id=020bbd75-403e-4dbb-8744-8ebc998cd4bb';
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': 'API_KEY',
'X-RapidAPI-Host': 'large-text-to-speech.p.rapidapi.com'
}
};
module.exports = () => fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment