Example
Example using axios
Understood and learned
const axios = require('axios')
/** get method */
const json = await (await axios.get('https://api.alyachan.dev/api/tiktok?url=https://vm.tiktok.com/ZSR7c5G6y/&apikey=YOUR_KEY')).data
console.log(json)
/** post method */
const json = await (await axios.post('https://api.alyachan.dev/api/text2vid', {
promt: 'anime girl red hair',
model: 'anime',
apikey: 'YOUR_KEY'
})).data
console.log(json)
Example using @moonr/api
Understood and learned
/** first create an .env file to put the url and apikey to be safe */
API_ENDPOINT = 'https://api.alyachan.dev/'
API_KEY = 'yourkey'
const Api = new (require('@moonr/api'))
/** get method */
const json = await Api.get('api/tiktok', {
url: 'https://vm.tiktok.com/ZSR7c5G6y/'
})
console.log(json)
/** post method */
const json = await Api.post('api/text2vid', {
promt: 'anime girl red hair',
model: 'anime'
})
console.log(json)