function transformResponses(req, res, collectionMetadata) {
	console.log("transformResponses Stark middleware");

	if (isGetCollectionRequest(req)) {
		// Add "metadata" and "etags" to all responses of GetCollection requests
		addPaginationMetadata(req, res, collectionMetadata);
		addSortingMetadata(req, collectionMetadata);
		addEtagInfo(res, collectionMetadata);
		console.log("response transformed for getCollection request => %s", req.url);
	} else if (req.method !== "DELETE") {
		// Add "etag" to all responses of SingleItem requests except DELETE
		addEtagInfo(res);
		console.log("response transformed for single item request => %s", req.url);
	}

	if (isNestedResourceQuery(req)) {
		// remove the parent resource data and return only the nested resource
		var nestedResourceName = getNestedResourceName(req);
		var data = res.locals.data;

		// the nested resource is returned in an array since the query most likely doesn't have a nested resource uuid defined
		// so an array is expected to be returned
		res.locals.data = [Object.assign({}, data[nestedResourceName])];
		console.log("response transformed for nested resource request => %s", req.url);
	}
}
/**
 * Default Stark response transformations: metadata and etags
 * @param req {*} The current request (already changed by Stark default middleware)
 * @param res {*} The current response (already changed by Stark default middleware)
 * @param collectionMetadata : Metadata object constructed by the Stark middleware (only for Collection responses)
 */
Default Stark response transformations: metadata and etags
@param req {*} The current request (already changed by Stark default middleware)
@param res {*} The current response (already changed by Stark default middleware)
@param collectionMetadata : Metadata object constructed by the Stark middleware (only for Collection responses)
Default Stark response transformations : metadata and etags @param req { * } The current request ( already changed by Stark default middleware ) @param res { * } The current response ( already changed by Stark default middleware ) @param collectionMetadata : Metadata object constructed by the Stark middleware ( only for Collection responses )
function transformResponses(req, res, collectionMetadata) {
	console.log("transformResponses Stark middleware");
	if (isGetCollectionRequest(req)) {
		addPaginationMetadata(req, res, collectionMetadata);
		addSortingMetadata(req, collectionMetadata);
		addEtagInfo(res, collectionMetadata);
		console.log("response transformed for getCollection request => %s", req.url);
	} else if (req.method !== "DELETE") {
		addEtagInfo(res);
		console.log("response transformed for single item request => %s", req.url);
	}
	if (isNestedResourceQuery(req)) {
		var nestedResourceName = getNestedResourceName(req);
		var data = res.locals.data;
		res.locals.data = [Object.assign({}, data[nestedResourceName])];
		console.log("response transformed for nested resource request => %s", req.url);
	}
}
function transformResponses ( req , res , collectionMetadata ) { console . log ( "transformResponses Stark middleware" ) ; if ( isGetCollectionRequest ( req ) ) { addPaginationMetadata ( req , res , collectionMetadata ) ; addSortingMetadata ( req , collectionMetadata ) ; addEtagInfo ( res , collectionMetadata ) ; console . log ( "response transformed for getCollection request => %s" , req . url ) ; } else if ( req . method !== "DELETE" ) { addEtagInfo ( res ) ; console . log ( "response transformed for single item request => %s" , req . url ) ; } if ( isNestedResourceQuery ( req ) ) { var nestedResourceName = getNestedResourceName ( req ) ; var data = res . locals . data ; res . locals . data = [ Object . assign ( { } , data [ nestedResourceName ] ) ] ; console . log ( "response transformed for nested resource request => %s" , req . url ) ; } }
Default Stark response transformations: metadata and etags
 @param req {*} The current request (already changed by Stark default middleware)
 @param res {*} The current response (already changed by Stark default middleware)
 @param collectionMetadata : Metadata object constructed by the Stark middleware (only for Collection responses)
Default Stark response transformations : metadata and etags @param req { * } The current request ( already changed by Stark default middleware ) @param res { * } The current response ( already changed by Stark default middleware ) @param collectionMetadata : Metadata object constructed by the Stark middleware ( only for Collection responses )
// Add "metadata" and "etags" to all responses of GetCollection requests // Add "etag" to all responses of SingleItem requests except DELETE // remove the parent resource data and return only the nested resource // the nested resource is returned in an array since the query most likely doesn't have a nested resource uuid defined // so an array is expected to be returned