lib/logger.js
function getPort(req) {
		if (req.connection && req.connection.localPort) {
			return req.connection.localPort.toString();
		}
		const host = req.headers && req.headers.host;
		let protocolSrc = 80;
		if (host && ((host.match(/:/g) || []).length) === 1) {
			const possiblePort = host.split(':')[1];
			protocolSrc = isNaN(possiblePort) ? protocolSrc : possiblePort;
		}
		return protocolSrc;
	}
function getPort(req) {
		if (req.connection && req.connection.localPort) {
			return req.connection.localPort.toString();
		}
		const host = req.headers && req.headers.host;
		let protocolSrc = 80;
		if (host && ((host.match(/:/g) || []).length) === 1) {
			const possiblePort = host.split(':')[1];
			protocolSrc = isNaN(possiblePort) ? protocolSrc : possiblePort;
		}
		return protocolSrc;
	}
function getPort ( req ) { if ( req . connection && req . connection . localPort ) { return req . connection . localPort . toString ( ) ; } const host = req . headers && req . headers . host ; let protocolSrc = 80 ; if ( host && ( ( host . match ( / : / g ) || [ ] ) . length ) === 1 ) { const possiblePort = host . split ( ':' ) [ 1 ] ; protocolSrc = isNaN ( possiblePort ) ? protocolSrc : possiblePort ; } return protocolSrc ; }
derive the port if its in the host string.
@param  {Object} req a express req object
@return {string}     string representation of port
derive the port if its in the host string .