text: 'use strict';
  
  var SwaggerExpress = require('swagger-express-mw');
  var SwaggerUi = require('swagger-tools/middleware/swagger-ui');
  var app = require('express')();
  module.exports = app; // for testing
  
  var config = {
    appRoot: __dirname // required config
  };
  
  SwaggerExpress.create(config, function (err, swaggerExpress) {
    if (err) {
      throw err;
    }
    
    // change host
    swaggerExpress.runner.swagger.host = 'bform.lk:8080';
    
    // add swagger-ui
    app.use(SwaggerUi(swaggerExpress.runner.swagger));
  
    // install middleware
    swaggerExpress.register(app);
  
    var port = process.env.PORT || 10010;
    app.listen(port);
  
    if (swaggerExpress.runner.swagger.paths['/hello']) {
      console.log('try this:\ncurl http://127.0.0.1:' + port + '/api/v1/hello?name=Scott');
    }
  });
  