generators/app/templates/server/api/user(auth)/user.controller.js
function (req, res, next) {
    if (!req.userInfo) {
      return res.unauthorized();
    }

    return res.ok(req.userInfo.profile);
  }
function (req, res, next) {
    if (!req.userInfo) {
      return res.unauthorized();
    }

    return res.ok(req.userInfo.profile);
  }
function ( req , res , next ) { if ( ! req . userInfo ) { return res . unauthorized ( ) ; } return res . ok ( req . userInfo . profile ) ; }
Get the authenticated user for the current request.
The requested user id is read from the userInfo parameter of the request object.
@param {IncomingMessage} req - The request message object the user object is read from
@param {ServerResponse} res - The outgoing response object
@param {function} next - The next handler function
@returns {ServerResponse} The virtual 'profile' of this user or UNAUTHORIZED if no document has been found
Get the authenticated user for the current request . The requested user id is read from the userInfo parameter of the request object .