'use strict';

/**
 * Imports.
 */
const express = require('express');

/**
 * Initialize Express.
 */
const app = express();

// Setup locals variable in config/index.js.
app.locals = require('./config');

// Configure express app based on local configuration.
app.set('env', app.locals.express.env);

/**
 * Routing.
 */
// Root:
app.get('/', (req, res) => {
  res.send('Hi, I\'m Blink!');
});

// Api root:
app.use('/api', require('./api'));

// API Version 1
app.use('/api/v1', require('./api/v1'));

/**
 * Listen.
 */
app.listen(app.locals.express.port, () => {
  app.locals.logger.info(`Blink is listening on port:${app.locals.express.port} env:${app.get('env')}`);
});

module.exports = app;

'use strict';

/**
 * Imports.
 */
const express = require('express');
const http = require('http');

/**
 * Initialize Express.
 */
const app = express();

// Setup locals variable in config/index.js.
app.locals = require('./config');

// Configure express app based on local configuration.
app.set('env', app.locals.express.env);

/**
 * Routing.
 */
// Root:
app.get('/', (req, res) => {
  res.send('Hi, I\'m Blink!');
});

// Api root:
app.use('/api', require('./api'));

// API Version 1
app.use('/api/v1', require('./api/v1'));

/**
 * Create server.
 */
const server = http.createServer(app);
server.listen(app.locals.express.port, () => {
  const address = server.address();
  app.locals.logger.info(`Blink is listening on port:${address.port} env:${app.locals.express.env}`);
});

module.exports = app;

Print actual port number in server init log
Print actual port number in server init log
