/**
 * # Environment variables
 *
 * dev port: 8080, gulp port: 9090
*/
const PORT = process.env.PORT || 8080;

/**
 * Initialize express
 */
import express from 'express';
import middleware from './config/middleware.js';
import routes from './config/routes.js';


const app = express();
middleware(app, express);
routes(app, express);

console.log('Server listening on port: ' + PORT);
  app.listen(PORT);

module.exports = app;

@@ -384,28 +384,163 @@
 T);%0A
-  app.listen(PORT);%0A
+%0A// prevent server from running twice in tests%0Aif (!module.parent) %7B%0A  app.listen(PORT);%0A%7D%0A%0A// export app to make it available for consuption, esp by tests
 %0Amod

Add some comments, tools to ensure server runs well in test