Skip to content

Instantly share code, notes, and snippets.

@cmonacaps
Last active September 22, 2020 17:38
Show Gist options
  • Save cmonacaps/63cab833012a80c66fc9192d42783020 to your computer and use it in GitHub Desktop.
Save cmonacaps/63cab833012a80c66fc9192d42783020 to your computer and use it in GitHub Desktop.
const ax = require('axios')
const f = require('./requesterFunction')
const input = {
type: 'Dish',
id: 'f9abece6-10d6-4f49-8297-ae2fe6e07550',
data: {
name: 'cheese slice',
size: 'yield sign',
price: '5.50'
}
}
Promise.resolve(
f(input)
).then(
({status, content}) => {
console.log({status, content}) // note probably good return type on these functions.
}
).catch(
err => {
console.log(err.status, err.message) // i.e. convertable to HttpResponse
console.error(err) // also dump stack trace if worthwhile
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment