Skip to content
This repository has been archived by the owner on Mar 5, 2018. It is now read-only.

silas/hapi-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Hapi partial responses

Resources

License

Stars

Watchers

Forks

Packages

No packages published