0.1.0 • Published 9 years ago

hapi-oembed-provider v0.1.0

Weekly downloads
1
License
-
Repository
github
Last release
9 years ago

Hapi oEmbed Provider

An oembed provider handler for Hapi.js.

Build Status

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