animal-api
Version:
A simple api for fetching animal pics using node-fetch
31 lines • 1.22 kB
JavaScript
const fetch = require('node-fetch')
module.exports = {
cat: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/cat').then(res => res.json())
response(link)
},
dog: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/dog').then(res => res.json())
response(link)
},
panda: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/panda').then(res => res.json())
response(link)
},
redpanda: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/red_panda').then(res => res.json())
response(link)
},
birb: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/birb').then(res => res.json())
response(link)
},
fox: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/fox').then(res => res.json())
response(link)
},
koala: async(response) => {
const {link} = await fetch('https://some-random-api.ml/img/koala').then(res => res.json())
response(link)
},
}