Top level meta data to hapijs responses
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

hapi-response-meta

npm version Build Status

This Hapi plugin adds metadata to a hapi response.

Installation

$: npm install hapi-response-meta

Registration

var Hapi = require('hapi');

var hapi = new Hapi.Server();
hapi.connection();

hapi.register({
  register: require('hapi-response-meta'),
  options: {
    key: 'meta',
    content: {
        provided_by: 'Some Organization',
        site: 'example.com'
    },
    results: 'results',
    routes: ['/', '/api'],
    excludeFormats: ['csv']
  }
};

Example

curl -X GET http://www.example.com
{
    "meta": {
        "provided_by": "Some Organization",
        "site": "example.com"
    },
    "results": {
        "key": "value"
    }
}

Test

$ npm test