var pexec = require('../utils/command_line').pexec,
  redisCon = require('./redis_con'),
  dockerAdmin = require('./docker_admin'),
  angularAngularPhonecat = require('./angular_angular_phonecat'),
  phaser = require('./shaohua_phaser_101'),
  chjjTtyjs = require('./chjj_tty_js'),
  repoFactory = require('./repo_factory.js'),
  resWrite = require('../utils/res_write'),
  dockerCon = module.exports = {};

//redis kills container after 15 minutes
redisCon.stopCallback(function(data){
  console.log('cb', data);
  dockerAdmin.stopOne(data).then(function(output){
    console.log('stop success', output);
  });
});

dockerCon.create = function(req, res){
  var repo = req.body && req.body.repo;
  var dfd = Q.defer();

  console.log('repo', repo);

  switch(repo){
    case 'angular/angular-phonecat':
      dfd = angularAngularPhonecat.createAngular(req, res);
      break;
    case 'shaohua/phaser-101':
      dfd = phaser.create(req, res);
      break;
    case 'chjj/tty.js':
      dfd = chjjTtyjs.createTty(req, res);
      break;
    case 'mikeal/request':
    case 'daviferreira/medium-editor':
    case 'jakiestfu/medium.js':
    case 'base_case':
      dfd = repoFactory.createFactory['base_case'](req, res);
      break;
    default:
      console.log('default repo');
      dfd.reject();
      break;
  }
  
  dfd
    .then(function(data){
      resWrite(req, res, data);
    })
    .catch(function(data){
      resWrite(req, res, data);
    });
};

dockerCon.index = function(req, res){
  res.end('docker index');
};

dockerCon.stop = function(req, res){
  console.log('stop in routes');
  dockerAdmin
    .stopAllPro()
    .then(function(){
      resWrite(req, res, {step:'stop'});
    })
    .catch(function(err){
      resWrite(req, res, {data: err});
    });
};

@@ -1124,24 +1124,104 @@
 medium.js':%0A
+    case 'tholman/zenpen':%0A    case 'mduvall/grande.js':%0A    case 'sofish/pen':%0A
     case 'ba

Add three more libs