On the server, you can do
var groups = require.main.require('./src/groups');
groups.getUserGroups([1] /*array of uids*/, function(err, userGroups){
if (err) return;
// Returns an array of an array of group data.
console.log(userGroups[0]); // Prints an array of groups for uid 1
});
on the client, you can get a list of visible groups by doing:
$.getJSON('/api/user/USERSLUG/groups', function (data) {
// Returns an object with a 'groups' property, an array of visible group data.
console.log(data.groups);
});