lazorse-nesting

Flexible nested resource support for Lazorse

npm install lazorse-nesting
3 downloads in the last month

Lazorse-nesting

horse in a nest

This module can be @includeed into a Lazorse application to enable client-driven inlining of named resources. By client-driven, we mean that the client specifies a list of related resources as part of the request, and this extension takes care of inlining those resources into the response data.

How it works

The client to specifies keys they would like to have inlined into their response using a query parameter (inline by default). When those keys are seen in the response data, and the value of those keys looks like a URL path (such as the ones generated by the builtin @link helper), the value will be replaced with the response data of an internally dispatched request against that path.

To see how this looks in practice, check out this test.

npm loves you