hapi-fields

0.3.0 • Public • Published

Hapi Fields Build Status

This module adds partial response support to Hapi.

Documentation

See JSON Mask for the supported syntax.

Options

  • name (String, default: fields): query parameter

Example

var hapi = require('hapi');
 
var server = new hapi.Server();
server.connection({ port: 8000 });
 
server.route({
  method: 'GET',
  path: '/echo',
  handler: function(request, reply) {
    reply({ hello: 'jane', bye: 'john' });
  },
});
 
server.register({ register: require('hapi-fields') }, function(err) {
  if (err) throw err;
});
 
server.start();

Usage

$ curl http://127.0.0.1:8000/echo
{"hello":"jane","bye":"john"}
$ curl http://127.0.0.1:8000/echo?fields=hello
{"hello":"jane"}

License

This work is licensed under the MIT License (see the LICENSE file).

Package Sidebar

Install

npm i hapi-fields

Weekly Downloads

1

Version

0.3.0

License

MIT

Last publish

Collaborators

  • silas