0.3.0 • Published 8 years ago

hapi-fields v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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).