Skip to content

Instantly share code, notes, and snippets.

@dandean
Created March 28, 2014 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandean/4d29006129aef4fb1797 to your computer and use it in GitHub Desktop.
Save dandean/4d29006129aef4fb1797 to your computer and use it in GitHub Desktop.
// HTTP client to communicate with the user service:
var userServiceClient = client = restify.createJsonClient({
url: Service.config.userServiceUrl,
version: '*'
});
/**
* GET /user
* Gets the currently authenticated user
**/
server.get('/user', function(req, res, next) {
userServiceClient.get('/users/' + req.uid, function(error, clientReq, clientRes, result) {
if (error) return next(error);
res.send(clientRes.statusCode, result);
return next();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment