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