Filter the response of an action with output
output has the same syntax as input, but it is applied to the response: only the declared fields are sent, converted to their types. Declare it on every action that reads from a database and you cannot leak a field by accident.
NEWACTION('Users/read', {
name: 'Read a user',
output: 'id:String, name:String, age:Number',
action: function($) {
$.callback({ id: '1', name: 'Peter', age: '42', password: 'secret-hash', token: 'abc' });
}
});exports.install = function() {
ROUTE('GET /user/ --> *Users/read');
};