lib/routes/apiv1.js
function getConnection (req, res, next, connectionId) {
  let con = req.app.locals.redisConnections.find(function(connection) {
    return (connection.options.connectionId === connectionId);
  });
  if (con) {
    res.locals.connection = con;
    res.locals.connectionId = connectionId;
  }
  else {
    console.error('Connection with id ' + connectionId + ' not found.');
    return printError(res, next, null, req.originalUrl);
  }
  next();
}
function getConnection (req, res, next, connectionId) {
  let con = req.app.locals.redisConnections.find(function(connection) {
    return (connection.options.connectionId === connectionId);
  });
  if (con) {
    res.locals.connection = con;
    res.locals.connectionId = connectionId;
  }
  else {
    console.error('Connection with id ' + connectionId + ' not found.');
    return printError(res, next, null, req.originalUrl);
  }
  next();
}
function getConnection ( req , res , next , connectionId ) { let con = req . app . locals . redisConnections . find ( function ( connection ) { return ( connection . options . connectionId === connectionId ) ; } ) ; if ( con ) { res . locals . connection = con ; res . locals . connectionId = connectionId ; } else { console . error ( 'Connection with id ' + connectionId + ' not found.' ) ; return printError ( res , next , null , req . originalUrl ) ; } next ( ) ; }
method called to extract url parameter 'connectionId' from all routes.
The connection object found is attached to the res.locals.connection variable for all
following routes to work with. The connectionId param is attached to res.locals.connectionId.

This method exits with JSON error response if no connection is found.

@param {object} req Express request object
@param {object} res Express response object
@param {function} next The next middleware function to call
@param {string} [connectionId] The value of the connectionId parameter.
method called to extract url parameter connectionId from all routes . The connection object found is attached to the res . locals . connection variable for all following routes to work with . The connectionId param is attached to res . locals . connectionId .