restify-json-filtering
Visit http://anyfetch.com for details about AnyFetch.
This is a custom restify formatter to filter properties on JSON objects according to some custom param fields
How does this work?
Let's say you have an endpoint /search
returning the following data:
Once you setup this lib, when loading /search?fields=count,documents.id
you'll see:
Syntax
This should be a comma separated list of fields you want to retrieve. Arrays are "ignored" (see example above).
Leaving the parameter empty will not do any filtering.
Adding a trailing .
(dot) can be used to remove the content of an object (to count the number of items in an array without loading all the data).
How to use
var restify = ;// Replace "fields" by any name -- this will be used for the filtering data.var restifyJsonFilterer = 'fields'; var server = restify; // You need to add *at least* this middlewareserver;
Support: support@anyfetch.com
.