Skip to content

Instantly share code, notes, and snippets.

@Jesus82
Created May 24, 2020 18:30
Show Gist options
  • Save Jesus82/7cbff46f07233c0b72f6406afe8164b8 to your computer and use it in GitHub Desktop.
Save Jesus82/7cbff46f07233c0b72f6406afe8164b8 to your computer and use it in GitHub Desktop.
'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