diff --git a/.eslintrc.json b/.eslintrc.json index 67aab34..edf8f40 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,34 +12,44 @@ "es6": true }, "rules": { - "no-new-object": 1, - "no-reserved-keys": 1, - "no-array-constructor": 1, - "quotes": [1, "single"], - "max-len": [1, 120, 2], // 2 spaces per tab, max 80 chars per line - "no-inner-declarations": [1, "both"], - "no-shadow-restricted-names": 1, - "one-var": 0, - "vars-on-top": 1, - "eqeqeq": 1, + "arrow-spacing": "error", + "block-scoped-var": "error", + "block-spacing": "error", + "brace-style": ["error", "stroustrup", {}], + "camelcase": "error", + "comma-dangle": ["error", "never"], + "comma-spacing": ["error", { "before": false, "after": true }], + "comma-style": [1, "last"], + "consistent-this": [1, "_this"], "curly": [1, "multi"], + "eol-last": 1, + "eqeqeq": 1, + "func-names": 1, + "indent": ["error", 2, { "SwitchCase": 1 }], + "lines-around-comment": ["error", { "beforeBlockComment": true, "allowArrayStart": true }], + "max-len": [1, 240, 2], // 2 spaces per tab, max 80 chars per line + "new-cap": 1, + "newline-before-return": "error", + "no-array-constructor": 1, + "no-inner-declarations": [1, "both"], "no-mixed-spaces-and-tabs": 1, + "no-multi-spaces": 2, + "no-new-object": 1, + "no-shadow-restricted-names": 1, + "object-curly-spacing": ["error", "always"], + "padded-blocks": ["error", { "blocks": "never", "switches": "always" }], + "prefer-const": "error", + "prefer-template": "error", + "one-var": 0, + "quote-props": ["error", "always"], + "quotes": [1, "single"], + "radix": 1, + "semi": [1, "always"], "space-before-blocks": [1, "always"], "space-infix-ops": 1, - "eol-last": 1, - "comma-style": [1, "last"], - "no-comma-dangle": 1, - "semi": [1, "always"], - "radix": 1, - "camelcase": 1, - "new-cap": 1, - "consistent-this": [1, "_this"], - "func-names": 1, - "no-multi-spaces": 2, - "brace-style": [2,"1tbs",{}], - - "indent": [2,2], - "comma-spacing": ["error", { "before": false, "after": true }] + "vars-on-top": 1, + "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }], + "spaced-comment": ["error", "always", { "markers": ["/"] }] } -} \ No newline at end of file +} diff --git a/app/js/modules/bitcoin.js b/app/js/modules/bitcoin.js index fb8bdf6..0e00ae9 100644 --- a/app/js/modules/bitcoin.js +++ b/app/js/modules/bitcoin.js @@ -2,56 +2,55 @@ * Created by mdonnel on 22/03/2017. */ -let BitcoinModel = Backbone.Model.extend({ - initialize: function () { +const BitcoinModel = Backbone.Model.extend({ + 'initialize': function () { this.set('url', '/btc'); this.set('balanceUrl', '/balance'); - let data = { - lastGBP: 0.0, - lastUSD: 0.0, - lows: {gbp: 0, usd: 0}, - highs: {gbp: 0, usd: 0}, - eclass: '', - balance: 0.0, - trend: 0 + const data = { + 'lastGBP': 0.0, + 'lastUSD': 0.0, + 'lows': { 'gbp': 0, 'usd': 0 }, + 'highs': { 'gbp': 0, 'usd': 0 }, + 'eclass': '', + 'balance': 0.0, + 'trend': 0 }; this.set('btcdata', data); this.set('balance', 0); this.update(); this.updateHourly(); }, - update: function () { + 'update': function () { this.getBTC(); - //this.getBalance(); + // this.getBalance(); const now = new Date(); const mod = 300000 - (now.getTime() % 300000); - let btcupdateFn = function() { + const btcupdateFn = function() { this.update(); }; setTimeout(btcupdateFn.bind(this), mod + 10); }, - updateHourly: function () { - + 'updateHourly': function () { this.getBalance(); const now = new Date(); const mod = 3600000 - (now.getTime() % 3600000); - let btcupdateFn = function() { + const btcupdateFn = function() { this.update(); }; setTimeout(btcupdateFn.bind(this), mod + 10); }, - recalc: function () { + 'recalc': function () { let data = this.get('btcdata'); let lastGBP = data.lastGBP; let lastUSD; - let g = data.gbp; - let u = data.usd; - let lows = data.lows; - let highs = data.highs; + const g = data.gbp; + const u = data.usd; + const lows = data.lows; + const highs = data.highs; let eclass = data.eclass; - let balance = data.balance; + const balance = data.balance; let trend = data.trend; if ((trend === undefined) || ( trend === null)) trend = 1; @@ -60,7 +59,8 @@ let BitcoinModel = Backbone.Model.extend({ if (data.lastGBP !== 0) if (g > lastGBP) { eclass = 'up'; - } else { + } + else { eclass = 'down'; } else { @@ -94,61 +94,61 @@ let BitcoinModel = Backbone.Model.extend({ this.set('btcdata', data); // total = myBTC * g; }, - getBTC: function () { - let self = this; - let url = this.get('url'); + 'getBTC': function () { + const self = this; + const url = this.get('url'); $.ajax({ - type: 'GET', - url: url, - data: '', - dataType: 'json', - timeout: 10000, - //contentType: ('application/json'), - headers: { + 'type': 'GET', + 'url': url, + 'data': '', + 'dataType': 'json', + 'timeout': 10000, + // contentType: ('application/json'), + 'headers': { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type' }, - success: function (data) { + 'success': function (data) { let gbp = data.bpi.GBP.rate_float, usd = data.bpi.USD.rate_float; - let trend = data.trend; - let btcdata = self.get('btcdata'); + const trend = data.trend; + const btcdata = self.get('btcdata'); btcdata.gbp = gbp; btcdata.usd = usd; btcdata.trend = trend; self.set('btcdata', btcdata); self.recalc(); }, - error: function (xhr, type) { + 'error': function (xhr, type) { console.log('ajax error'); console.log(xhr); console.log(type); } }); }, - getBalance: function() { - let self = this; - let url = this.get('balanceUrl'); + 'getBalance': function() { + const self = this; + const url = this.get('balanceUrl'); $.ajax({ - type: 'GET', - url: url, - data: '', - dataType: 'json', - timeout: 10000, - //contentType: ('application/json'), - headers: { + 'type': 'GET', + 'url': url, + 'data': '', + 'dataType': 'json', + 'timeout': 10000, + // contentType: ('application/json'), + 'headers': { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type' }, - success: function (data) { - let balance = data.balance; + 'success': function (data) { + const balance = data.balance; self.set('balance', balance); self.recalc(); }, - error: function (xhr, type) { + 'error': function (xhr, type) { console.log('ajax error'); console.log(xhr); console.log(type); @@ -156,22 +156,22 @@ let BitcoinModel = Backbone.Model.extend({ }); } }); -let Bitcoin = Backbone.View.extend({ - tagName: 'div', - initialize: function () { +const Bitcoin = Backbone.View.extend({ + 'tagName': 'div', + 'initialize': function () { _.bindAll(this, 'render'); this.model.bind('change', this.render); this.$btc = $('#btc'); this.$trend = $('#trend'); }, - render: function () { - let btcdata = this.model.get('btcdata'); - let balance = this.model.get('balance'); - //console.log(`Balance: ${btcdata.balance.toFixed(4)}`); - //console.log(btcdata.lastGBP); - let owned = parseFloat(btcdata.lastGBP) * parseFloat(balance); - //console.log(`owned: ${owned}`); - let title = 'High: $' + parseFloat(btcdata.highs.usd.toFixed(2)) + ' / Low $' + parseFloat(btcdata.lows.usd.toFixed(2)); + 'render': function () { + const btcdata = this.model.get('btcdata'); + const balance = this.model.get('balance'); + // console.log(`Balance: ${btcdata.balance.toFixed(4)}`); + // console.log(btcdata.lastGBP); + const owned = parseFloat(btcdata.lastGBP) * parseFloat(balance); + // console.log(`owned: ${owned}`); + const title = `High: $${ parseFloat(btcdata.highs.usd.toFixed(2)) } / Low $${ parseFloat(btcdata.lows.usd.toFixed(2))}`; let trendClass = ''; if (btcdata.trend > 1.00) diff --git a/app/js/modules/clock.js b/app/js/modules/clock.js index ae76a01..d6e1f9a 100644 --- a/app/js/modules/clock.js +++ b/app/js/modules/clock.js @@ -5,17 +5,17 @@ * Time: 14:20 * */ -var ClockModel = Backbone.Model.extend({ - initialize: function() { - this.set('now',new Date); +const ClockModel = Backbone.Model.extend({ + 'initialize': function () { + this.set('now', new Date); this.update(); }, - update: function() { - var now = new Date; - var mod = 60000 - (now.getTime() % 60000); - this.set('now',now); + 'update': function () { + const now = new Date; + const mod = 60000 - (now.getTime() % 60000); + this.set('now', now); - var clockFn = function() { + const clockFn = function () { this.update(); }; @@ -23,21 +23,21 @@ var ClockModel = Backbone.Model.extend({ } }); -var Clock = Backbone.View.extend({ - tagName: 'div', - initialize: function() { +const Clock = Backbone.View.extend({ + 'tagName': 'div', + 'initialize': function () { _.bindAll(this, 'render'); this.model.bind('change', this.render); this.$date = $('#date'); this.$time = $('#time'); this.render(); }, - render: function() { - var now = this.model.get('now'); - //var curTime = now.format('{24hr}{mm}'); - var curTime = now.format('{24hr} {mm}'); + 'render': function () { + const now = this.model.get('now'); + // var curTime = now.format('{24hr}{mm}'); + const curTime = now.format('{24hr} {mm}'); - var curDate = now.format('{yyyy}-{MM}-{dd}'); + const curDate = now.format('{yyyy}-{MM}-{dd}'); if (this.prevTime !== curTime) { this.$time.html(curTime); this.prevTime = curTime; diff --git a/app/js/modules/events.js b/app/js/modules/events.js index 9e51953..2901639 100644 --- a/app/js/modules/events.js +++ b/app/js/modules/events.js @@ -1,55 +1,56 @@ /** * Created by mdonnel on 10/04/2017. */ -let EventModel = Backbone.Model.extend({ - initialize: function () { +const EventModel = Backbone.Model.extend({ + 'initialize': function () { this.update(); }, - getDays : function(startdate, enddate) { - let r, s, e; - s = startdate.getTime(); - e = enddate.getTime(); - r = (e - s) / (24 * 60 * 60 * 1000); - return r; - }, - update: function () { - const now = new Date - const mod = 3600000 - (now.getTime() % 3600000) - let data = {}; + 'getDays' : function(startdate, enddate) { + let r, s, e; + s = startdate.getTime(); + e = enddate.getTime(); + r = (e - s) / (24 * 60 * 60 * 1000); + + return r; + }, + 'update': function () { + const now = new Date; + const mod = 3600000 - (now.getTime() % 3600000); + const data = {}; data.days = Math.ceil(this.getDays(now, this.get('event'))); data.weeks = Math.ceil(this.getDays(now, this.get('event')) / 7); this.set('data', data); const clockFn = function () { - this.update() - } + this.update(); + }; - setTimeout(clockFn.bind(this), mod + 10) + setTimeout(clockFn.bind(this), mod + 10); } }); -let EventView = Backbone.View.extend({ - tagName: 'div', - initialize: function () { - _.bindAll(this, 'render'); - this.model.bind('change', this.render); - this.id = 'e_' + Math.random().toString(36).substr(2, 9); - this.$events = $('#events'); - this.$myEvent = null; - this.$el = this.$events; - this.initView(); - this.render(); - }, - render: function () { - let label = this.model.get('label'); - let data = this.model.get('data'); - let str = `${label} ${data.days} days / ${data.weeks} weeks`; - this.$myEvent.empty().append(str); - }, - initView: function () { - let html = `
`; - this.$html = $(html); - this.$events.append(this.$html); - this.$myEvent = $(`#${this.id}`); - } +const EventView = Backbone.View.extend({ + 'tagName': 'div', + 'initialize': function () { + _.bindAll(this, 'render'); + this.model.bind('change', this.render); + this.id = `e_${ Math.random().toString(36).substr(2, 9)}`; + this.$events = $('#events'); + this.$myEvent = null; + this.$el = this.$events; + this.initView(); + this.render(); + }, + 'render': function () { + const label = this.model.get('label'); + const data = this.model.get('data'); + const str = `${label} ${data.days} days / ${data.weeks} weeks`; + this.$myEvent.empty().append(str); + }, + 'initView': function () { + const html = ``; + this.$html = $(html); + this.$events.append(this.$html); + this.$myEvent = $(`#${this.id}`); + } }); diff --git a/app/js/modules/fx.js b/app/js/modules/fx.js index 7dbe4b1..d77a9d7 100644 --- a/app/js/modules/fx.js +++ b/app/js/modules/fx.js @@ -2,71 +2,74 @@ * Created by mdonnel on 22/03/2017. */ -let FxModel = Backbone.Model.extend({ - initialize: function () { - this.set('url', '/fx'); - this.set('fxdata', {}); - this.update(); - }, - update: function () { - this.getFX(); - const now = new Date; - const mod = 900000 - (now.getTime() % 900000); +const FxModel = Backbone.Model.extend({ + 'initialize': function () { + this.set('url', '/fx'); + this.set('fxdata', {}); + this.update(); + }, + 'update': function () { + this.getFX(); + const now = new Date; + const mod = 900000 - (now.getTime() % 900000); - let fxUpdateFn = function() { - this.update(); - }; - setTimeout(fxUpdateFn.bind(this), mod + 10); - }, - getFX: function() { - let url = this.get('url'); - let self = this; - $.ajax({ - type: 'GET', - url: url, - data: '', - dataType: 'json', + const fxUpdateFn = function() { + this.update(); + }; + setTimeout(fxUpdateFn.bind(this), mod + 10); + }, + 'getFX': function() { + const url = this.get('url'); + const self = this; + $.ajax({ + 'type': 'GET', + 'url': url, + 'data': '', + 'dataType': 'json', - timeout: 10000, + 'timeout': 10000, - //contentType: ('application/json'), - headers: { - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS', - 'Access-Control-Allow-Headers': 'Content-Type' + // contentType: ('application/json'), + 'headers': { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type' - }, - success: function(data) { - let gpbex = (1 / data.rates.GBP); - let sekex = (gpbex * data.rates.SEK); - let fxdata = { - usd: 1, - gbp: data.rates.GBP, - sek: data.rates.SEK, - gpbe: gpbex, - sekex: sekex - }; - self.set('fxdata', fxdata); - }, - error: function(xhr, type) { - console.log('ajax error'); - console.log(xhr); - console.log(type); - } - }); + }, + 'success': function(data) { + let fxdata = {}; + if (data.rates !== undefined) { + const gpbex = (1 / data.rates.GBP); + const sekex = (gpbex * data.rates.SEK); + fxdata = { + 'usd': 1, + 'gbp': data.rates.GBP, + 'sek': data.rates.SEK, + 'gpbe': gpbex, + 'sekex': sekex + }; } -}); + self.set('fxdata', fxdata); + }, + 'error': function(xhr, type) { + console.log('ajax error'); + console.log(xhr); + console.log(type); + } + }); + } +}); const FxView = Backbone.View.extend({ - tagName: 'div', - initialize: function () { - _.bindAll(this, 'render'); - this.model.bind('change', this.render); - this.$fx = $('#fx'); - }, - render: function () { - let fxdata = this.model.get('fxdata'); - this.$fx.html(`£1 = $${parseFloat(fxdata.gpbe.toFixed(2))} = ${ parseFloat(fxdata.sekex.toFixed(2))} SEK`); - } + 'tagName': 'div', + 'initialize': function () { + _.bindAll(this, 'render'); + this.model.bind('change', this.render); + this.$fx = $('#fx'); + }, + 'render': function () { + const fxdata = this.model.get('fxdata'); + this.$fx.html(`£1 = $${parseFloat(fxdata.gpbe.toFixed(2))} = ${ parseFloat(fxdata.sekex.toFixed(2))} SEK`); + } }); diff --git a/app/js/modules/password.js b/app/js/modules/password.js index c44a9a8..606f96c 100644 --- a/app/js/modules/password.js +++ b/app/js/modules/password.js @@ -1,83 +1,103 @@ /** * Created by mdonnel on 20/04/2017. */ -_.templateSettings = { - evaluate: /\{\{(.+?)\}\}/g, - interpolate: /\{\{=(.+?)\}\}/g, - escape: /\{\{-(.+?)\}\}/g -}; +/*_.templateSettings = { + 'evaluate': /\{\{(.+?)\}\}/g, + 'interpolate': /\{\{=(.+?)\}\}/g, + 'escape': /\{\{-(.+?)\}\}/g +};*/ Array.prototype.random = function () { - return this[Math.floor((Math.random() * this.length))]; + return this[Math.floor((Math.random() * this.length))]; }; const PasswordView = Backbone.View.extend({ - el: '#passwords', - passwordTemplate: _.template($('#password-template').html()), - initialize: function () { - this.alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - this.whitespace = ['.', '~', '#', '!', '$', '+', '-', '+']; - this.numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - this.left = ['Alabama', - 'Alaska', - 'Arizona', - 'Maryland', - 'Nevada', - 'Mexico', - 'Texas', - 'Utah', - 'Glasgow', - 'Inverness', - 'Edinburgh', - 'Dumbarton', - 'Balloch', - 'Renton', - 'Cardross', - 'Dundee', - 'Paisley', - 'Hamilton', - 'Greenock', - 'Falkirk', - 'Irvine', - 'Renfrew', - 'Erskine', - 'London', - 'Hammersmith', - 'Islington', - 'Silver', 'Black', 'Yellow', 'Purple', 'White', 'Pink', 'Red', 'Orange', 'Brown', 'Green', 'Blue', 'Amber', 'Aqua', 'Azure', 'Bronze', 'Coral', 'Copper', 'Crimson', 'Cyan', 'Ginger', 'Gold', 'Indigo', 'Jade' + 'el': '#passwords', + 'passwordTemplate': _.template('Destination | Time | @@ -143,89 +132,75 @@ let TrainView = Backbone.View.extend({Platform | |
---|---|---|---|
${dest.locationName} ${via} | -${time} | -${status} | -${platform} | -
${dest.locationName} ${via} | -${time} | -❌ ${item.cancelReason} | - -|
${dest.locationName} ${via} | +${time} | +${status} | +${platform} | +
${dest.locationName} ${via} | ${time} | +❌ ${item.cancelReason} | |
🚌 ${dest.locationName} ${via} | -${time} | -${status} | -${platform} | -
Destination | \nTime | \nStatus | \nPlatform |
---|---|---|---|
"+l.locationName+" "+d+" | \n"+u+' | \n❌ '+r.cancelReason+" | \n \n|
"+l.locationName+" "+d+" | \n"+u+" | \n"+c+" | \n"+h+" | \n
🚌 "+v.locationName+" "+y+" | \n"+$+" | \n"+C+" | \n"+T+" | \n
Destination | \nTime | \nStatus | \nPlatform |
---|---|---|---|
' + dest.locationName + ' ' + via + ' | \n' + time + ' | \n' + _status + ' | \n' + platform + ' | \n
' + dest.locationName + ' ' + via + ' | ' + time + ' | \n\u274C ' + _item.cancelReason + ' | |
\uD83D\uDE8C ' + _dest.locationName + ' ' + _via + ' | ' + _time + ' | ' + _status2 + ' | ' + _platform + ' |
'); - output = output.replace(/(\r\n)/g, " "); - output = output.replace(/(\\r\\n)/g, " "); + var output = source.replace(r.msoTags, ''); + output = output.replace(r.msoParagraphs, '
'); + output = output.replace(/(\r\n)/g, ' '); + output = output.replace(/(\\r\\n)/g, ' '); - output = output.replace(/<\/i>/g, ""); - output = output.replace(/[“|”]/g, '"'); - output = output.replace(/’/g, "'"); - output = output.replace(/…/g, "…"); - output = output.replace(/(.*?)<\/i>/g, "$1"); - output = output.replace(/(.*?)<\/b>/g, "$1"); - output = output.replace(/
\*\*\*<\/p>/g, "
* * *
"); + output = output.replace(/<\/i>/g, ''); + output = output.replace(/[“|”]/g, '"'); + output = output.replace(/’/g, '\''); + output = output.replace(/…/g, '…'); + output = output.replace(/(.*?)<\/i>/g, '$1'); + output = output.replace(/(.*?)<\/b>/g, '$1'); + output = output.replace(/\*\*\*<\/p>/g, '
* * *
'); - output = output.replace(/CHAPTER\s(\d.?)<\/p>/, "
( |\s|\s<\/em>)<\/p>/g, "");
- output = output.replace(/ /g, " ");
+ output = output.replace(/ CHAPTER\s(\d.?)<\/p>/, ' ( |\s|\s<\/em>)<\/p>/g, '');
+ output = output.replace(/ /g, ' ');
- output = output.replace(/ \s<\/em><\/p>/g, "");
- output = output.replace(/ \s<\/p>/g, "");
+ output = output.replace(/ \s<\/em><\/p>/g, '');
+ output = output.replace(/ \s<\/p>/g, '');
- output = output.replace(/\s+/g, " ");
- output = output.replace(/<\/p>/g, "$1
');
+ output = output.replace(/
' + JSON.stringify( profile, null, 2 ) + '' ); + res.send( `
${ JSON.stringify( profile, null, 2 ) }` ); }); else - res.send( '
' + JSON.stringify( profile, null, 2 ) + '' ); + res.send( `
${ JSON.stringify( profile, null, 2 ) }` ); }); }); app.get( '/fb-today', function( req, res, next ) { const today = Date.create('today').format('{yyyy}-{MM}-{dd}'); - const url = 'https://api.fitbit.com/1/user/-/activities/date/' + today + '.json'; + const url = `https://api.fitbit.com/1/user/-/activities/date/${ today }.json`; fitbit.request({ - uri: url, - method: 'GET', + 'uri': url, + 'method': 'GET' }, function( err, body, token ) { if ( err ) return next( err ); var profile = JSON.parse( body ); @@ -190,10 +180,10 @@ app.get( '/fb-today', function( req, res, next ) { if ( token ) persist.write( tfile, token, function( err ) { if ( err ) return next( err ); - res.send( '
' + JSON.stringify( profile, null, 2 ) + '' ); + res.send( `
${ JSON.stringify( profile, null, 2 ) }` ); }); else - res.send( '
' + JSON.stringify( profile, null, 2 ) + '' ); + res.send( `
${ JSON.stringify( profile, null, 2 ) }` ); }); }); @@ -206,7 +196,6 @@ app.get('/fitbit_auth_callback', function(req, res, next) { fitbit.fetchToken(code, function(err, token) { if (err) return next(err); - // persist the token jsonfile.writeFile(tfile, token, function(err) { @@ -215,21 +204,17 @@ app.get('/fitbit_auth_callback', function(req, res, next) { console.log('!!!! Fitbit token saved'); res.redirect('/fb-profile'); - }); }); }); - jsonfile.readFile('./fb-token.json', function(err, obj) { if (err) logger.error(err); else fitbit.setToken(obj); - }); - // }); /** @@ -242,10 +227,8 @@ http.createServer(app).listen(app.get('port'), function () { }); */ - - server.on('request', app); server.listen(port, () => { - logger.info('New server listening on ' + server.address().port); + logger.info(`New server listening on ${ server.address().port}`); });