diff --git a/lib/relations.js b/lib/relations.js index a5372f92..5b799556 100644 --- a/lib/relations.js +++ b/lib/relations.js @@ -277,6 +277,15 @@ Relation.belongsTo = function (anotherClass, params) { } }; + // Set the remoting metadata so that it can be accessed as /api/// + // For example, /api/orders/1/customer + var fn = this.prototype[methodName]; + fn.shared = true; + fn.http = {verb: 'get', path: '/' + methodName}; + fn.accepts = {arg: 'refresh', type: 'boolean', http: {source: 'query'}}; + fn.description = 'Fetches belongsTo relation ' + methodName; + fn.returns = {arg: methodName, type: 'object', root: true}; + }; /**