index.js
function middlewareFunction (req,res,next){

  return ipToLocation(req.ip)
    .then(function (location) {
      req.location = location;
      next();
    })
    .catch(function (error) {
      req.locationError = error;
      next();
    })

}
function middlewareFunction (req,res,next){

  return ipToLocation(req.ip)
    .then(function (location) {
      req.location = location;
      next();
    })
    .catch(function (error) {
      req.locationError = error;
      next();
    })

}
function middlewareFunction ( req , res , next ) { return ipToLocation ( req . ip ) . then ( function ( location ) { req . location = location ; next ( ) ; } ) . catch ( function ( error ) { req . locationError = error ; next ( ) ; } ) }
Middleware Function for the IP
@param {Request} req
@param {Response} res
@param {function} next
Middleware Function for the IP