hapi-oembed-provider

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i hapi-oembed-provider

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • grayside