Created
May 20, 2019 19:23
-
-
Save lvreynoso/259c79cf0dd0b0b8b255cb11fc8e817b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test our charity navigator api wrapper | |
app.get('/charities/test', (req, res) => { | |
let test = { | |
result: {}, | |
collection: {}, | |
organization: {} | |
}; | |
test.result.query = modules.charityNavigator.test(); | |
test.collection.query = modules.charityNavigator.collection('10', '1', 'fire') | |
modules.axios.get(modules.charityNavigator.collection('10', '1', 'fire')) | |
.then(collection => { | |
test.collection.response = collection; | |
test.organization.query = modules.charityNavigator.organization('411867244'); | |
modules.axios.get(modules.charityNavigator.organization('411867244')) // test ein | |
.then(organization => { | |
test.organization.response = organization; | |
res.render('charities-test', { | |
test: test | |
}) | |
}) | |
.catch(error => { | |
console.log(error); | |
test.organization.response = String(error.response.status + ' ' + error.response.statusText) | |
res.render('charities-test', { | |
test: test | |
}) | |
}) | |
}) | |
.catch(error => { | |
console.log(error); | |
res.render('charities-test', { | |
test: test | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment