var getApp = function (config) {
	var express = require('express');
	var app = express();
	var bodyParser=require('body-parser');
	var methodOverride=require('method-override');
	var cookieParser=require('cookie-parser');
	var errorHandler=require('errorhandler');
	//middleware
	function local_env (req, res, next){
		res.local.real_time_server=config.server.production.real_time_server;
		next();
	}

		app.set('views', __dirname + '/views');
		app.set('view engine', 'ejs');
		app.engine('.html', require('ejs').renderFile);
		app.engine('.ejs', require('ejs').renderFile);
		app.use(bodyParser());
		app.use(methodOverride());
		app.use(cookieParser());
				
		app.use(local_env);
		
		var oneYear = 31557600000;
		app.use(express.static(__dirname + '/public', { maxAge: oneYear }));

	  app.use(errorHandler({ dumpExceptions: true, showStack: true })); 


	//routes
	require('./routes/index').configure(app);

	return app;
};

exports.getApp = getApp;

@@ -261,145 +261,8 @@
 r');
-%0A%09//middleware%0A%09function local_env (req, res, next)%7B%0A%09%09res.local.real_time_server=config.server.production.real_time_server;%0A%09%09next();%0A%09%7D
 %0A%0A%09%09
@@ -524,26 +524,180 @@
 %09%09%0A%09
-%09app.use(local_env
+//middleware%0A%09%09app.use(function(req, res, next)%7B%0A                %09res.locals.real_time_server=config.server.production.real_time_server;%0A                %09next();%0A        %09%7D
 );%0A%09

update express from 2.5 to 4