Created
May 24, 2020 18:30
-
-
Save Jesus82/7cbff46f07233c0b72f6406afe8164b8 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
'use strict'; | |
/** | |
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers) | |
* to customize this controller | |
*/ | |
const { axios } = require('axios'); | |
const { sanitizeEntity } = require('strapi-utils'); | |
const untappd = { | |
url: 'https://api.myapi/', | |
clientId: '1234', | |
clientSecret: '5678' | |
}) | |
module.exports = { | |
async findOne(ctx) { | |
const { untappd_id } = ctx.params | |
const entity = await strapi.services.festival.findOne({ untappd_id }) | |
entity.untappd = await axios.get(untappd.url + clientId + clientSecret) | |
return sanitizeEntity(entity, { model: strapi.models.festival }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment