Ghost/core/server/api/canary/oembed.js
Hannah Wolfe 0bdaa216e5
Refactored tpl to never be used in DI
- Ghost has a set of core packages that it is safe to require directly in any file - tpl is one of them!
- This keeps the DI signature smaller and easier to reason about
2021-10-11 15:19:54 +01:00

24 lines
528 B
JavaScript

const config = require('../../../shared/config');
const externalRequest = require('../../lib/request-external');
const OEmbed = require('../../services/oembed');
const oembed = new OEmbed({config, externalRequest});
module.exports = {
docName: 'oembed',
read: {
permissions: false,
data: [
'url',
'type'
],
options: [],
query({data}) {
let {url, type} = data;
return oembed.fetchOembedDataFromUrl(url, type);
}
}
};