hapi-oembed-provider
v0.1.0
Published
Serve oEmbed resources from Hapi.js
Downloads
5
Readme
Hapi oEmbed Provider
An oembed provider handler for Hapi.js.
Options
All oembed payload responses are valid option keys for the oEmbed handler.
The 'html' and 'title' keys may be callbacks to facilitate data real-time data-loading.
Setting Up Routes
In your oEmbed provider routes, you will want to add the following validation. (Assumes Joi library for route validation.)
validate: {
query: {
url: Joi.required(),
maxwidth: Joi.number().integer().min(1).default(600),
maxheight: Joi.number().integer().min(1).default(600),
}
}
Example
handler: {
oembed: {
type: 'rich',
html: function(options, request) {
return '<aside>This is the greatest</aside>'
},
title: function(options, request) {
return 'Example',
},
provider_name: 'Example Content Provider',
provider_url: 'http://example.com'
}
}
License
MIT © Adam Ross