Skip to content

Instantly share code, notes, and snippets.

@sachinsmc
Created July 25, 2017 20:28
//user profile
namaste_user.profile = function(data, callback) {
console.log('sending user details....');
namaste_user.find({
where: {
mobile: data.mobile
}
}, function(err, mobileResult) {
if (err) {
callback(err, null);
} else {
if (mobileResult && mobileResult.length > 0) {
var obj={
"message":"user details fetched",
"response_code":"200",
"status":true,
"user":mobileResult[0]
}
callback(null,obj);
}
}
});
};
namaste_user.remoteMethod(
'profile', {
accepts: {
arg: 'data',
type: 'object',
http: {
source: 'body'
}
},
returns: {
arg: 'data',
type: 'array'
},
http: {
path: '/profile',
verb: 'post'
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment