const dog = client.get('http://localhost:3002/dog', function (error, dog) {
if (error) { throw error }
if (dog) {
return JSON.parse(dog)
} else {
axios('http://localhost:3002/dog')
.then((response) => {
return response.data
client.set('http://localhost:3002/dog', JSON.stringify(response.data), function (error) {
if (error) { throw error }
})
})
.catch(error => error)
}
})