Пример #1
0
site.configure(function(){
	site.set('port', config.site.port);
	site.set('views', __dirname + '/views');
	site.set('view engine', 'jade');
	site.set('env', config.env.current);

	// Only log requests in dev
	if (config.env.development) {
		site.use(express.logger({
			format: 'dev',
			stream: {
				write: function (message) {
					log.info(message.trim());
				}
			}
		}));
	}

	site.use(express.bodyParser());
	site.use(express.methodOverride());
	site.use(express.responseTime());
	site.use(expressValidator);
	site.use(connectAssets({
		src: path.join(__dirname, 'public')
	}));
	site.use(site.router);
	site.use(express.static(path.join(__dirname, 'public')));
});
Пример #2
0
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');

  // export jade templates to reuse on client side
  // This includes a kind of terrible cache-buster hack
  // It generates a new cache-busting query string for the script tag every time the server starts
  // This should probably only happen every time there's a change to the templates.js file
  var jadeTemplatesPath = '/js/templates.js';
  app.use(jadeBrowser(jadeTemplatesPath, ['*.jade', '*/*.jade'], { root: __dirname + '/views', minify: true }));
  var jadeTemplatesCacheBuster = (new Date()).getTime();
  var jadeTemplatesSrc = jadeTemplatesPath + '?' + jadeTemplatesCacheBuster;
  global.jadeTemplates = function() { return '<script src="' + jadeTemplatesSrc + '" type="text/javascript"></script>'; }

  // use the connect assets middleware for Snockets sugar
  app.use(connectAssets());

  app.use(express.favicon());
  app.use(express.logger(config.loggerFormat));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser(config.sessionSecret));
  app.use(express.session({ store: sessionStore }));
  app.use(passport.initialize());
  app.use(passport.session());
  app.use(app.router);
  
  app.use(lessMiddleware({ src: __dirname + '/public' }));
  app.use(express.static(path.join(__dirname, 'public')));

  if(config.useErrorHandler) app.use(express.errorHandler());
});
Пример #3
0
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.engine('html', templates.forExpress() );
  app.engine('txt',  engines.hogan);

  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(assets({ paths: [ config.public_dir + '/js', config.public_dir + '/css' ] }));

  app.locals( require('../lib/middleware/config') );

  app.use(masterSelector());

  app.use(passport.initialize());
  app.use(passport.session());

  app.use(require('../lib/authorization').middleware());

  app.use(require('../lib/apps/auth').middleware);

  app.use( '/docs', require('../lib/apps/docs.js')() );
  app.use('/info', require('../lib/apps/info')() );

  app.use(require('../lib/apps/registration'));
  app.use(require('../lib/apps/login'));
  app.use(require('../lib/apps/apikey'));
});
Пример #4
0
app.configure(function() {
    app.set('views', views);
    app.set('view engine', 'jade');

    // uncompressed html output
    app.locals({
        pretty : true,
        layout: false
    });

    // parses x-www-form-urlencoded request bodies (and json)
    app.use(express.bodyParser());
    app.use(express.methodOverride());

    // main routing
    app.use(app.router);

    // res
    app.use(express.favicon());
    app.use(express.static(static_root));

    app.use(connectAssets({
        src : __dirname + "/public"
    }));
});
Пример #5
0
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.set('view options', {layout: false});

  app.use(express.favicon());
  app.use(assets());
  app.use(express.static(__dirname + '/public'));

  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser());
  app.use(express.session({
      secret: CONFIG.SESSION_SECRET
    , store: new MongoSession({url: CONFIG.MONGO_URI})
  }));

  app.use(mw.loadUser);
  app.param('post_id', mw.loadPost);

  app.use(app.router);
  app.use(express.errorHandler({
      dumpExceptions: true
    , showStack: true
  }));
});
Пример #6
0
function middleware(app){

	// initialize passport singleton
	passportConf();

	app.use(connectAssets({
		paths: [path.join(appRoot, 'public/css'),
				path.join(appRoot, 'public/js'),
				path.join(appRoot, 'bower_components')],
		helperContext: app.locals
	}));

	app.use(express.compress());
	app.use(express.favicon());
	app.use(express.logger('dev'));
	app.use(express.cookieParser());
	app.use(express.json());
	app.use(express.urlencoded());
	app.use(expressValidator());
	app.use(express.methodOverride());
	app.use(express.session({
		secret: secrets.sessionSecret,
		store: new MongoStore({
			url: secrets.db,
			auto_reconnect: true
		})
	}));
	app.use(express.csrf());
	app.use(passport.initialize());
	app.use(passport.session());
	// after passport auth store these to res.locals to be accessed when rendering the views
	app.use(function(req, res, next) {
		res.locals.user = req.user;
		res.locals.token = req.csrfToken();
		res.locals.secrets = secrets;
		next();
	});
	app.use(flash());
	app.use(express.static(path.join(appRoot, 'public'), { maxAge: month }));
	app.use(function(req, res, next) {
		  // Keep track of previous URL
		  if (req.method !== 'GET') return next();
		  var path = req.path.split('/')[1];
		  if (/(auth|login|logout|signup)$/.test(path)) return next();
		  req.session.returnTo = req.path;
		  next();
		});
	// middleware to get the requested URL and use it when rendering the views (for HBS helpers especially)
	app.use(function (req, res, next) {
		res.locals.currentUrl = req.url;
		next();
	});
	app.use(app.router);
	app.use(function(req, res) {
		res.status(404);
		res.render('404');
	});
	app.use(express.errorHandler());
}
Пример #7
0
app.configure(function(){
    
  app.set('views', __dirname + '/views');
  app.engine('html', templates.forExpress() );
  app.engine('txt',  engines.hogan);
    
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(assets({ paths: [ config.public_dir + '/js', config.public_dir + '/css' ] }));
});
Пример #8
0
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(assets());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});
Пример #9
0
module.exports = function(app, express) {

    app.use(express.logger('dev'));

    //Enable dependency based asset loading
    app.use(connectAssets({
        src : __dirname + "/../public"
    }));

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

}
Пример #10
0
module.exports = function(app, express) {
    
    app.use(express.logger({ 
        format: 'tiny', 
        stream: fs.createWriteStream('logs/node.log')
    }));
    
    // setup concatenate and compress build dir
    app.use(connectAssets({
        src : __dirname + "/../public",
        buildDir: 'public_build'
    }));

    app.use(express.staticCache());
    
    app.use(express.errorHandler());

}
Пример #11
0
function createServer() {
  var assets = require('connect-assets');
  var express = require("express");
  var app = express();

  //config
  app.set('view engine', 'jade');
  app.set('views', __dirname + '/../app/views');

  //middleware
  app.use(express.logger());
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.static(__dirname + '/../assets'));
  app.use(assets());
  app.configure('development', function() {
    app.use(express.errorHandler({ showStack: true, dumpExceptions: true }));
  });
  app.configure('production', function() {
    app.use(express.errorHandler());
  });

  return app;
}
Пример #12
0
module.exports.public = function(app, express) {
  console.log(__dirname);
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/../app/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser('is it secret? is it safe?'));
  app.use(express.session());
  app.use(app.router);
  app.use(assets())
  app.use(require('stylus').middleware(__dirname + '/../public'));
  app.use(express.static(path.join(__dirname, '../public')));

  // development only
  if (app.get('env') == 'development') {
    app.use(express.errorHandler());
  }

  css.root = 'stylesheets'
  js.root  = 'javascripts'
}
Пример #13
0
  configureApp: function(){
    helpers(app);
    //run express with ejs support
    app.engine('ejs', engine);

    //custom ejs parser
    ejs.open  = '<?';
    ejs.close = '?>';

    //run middleware
    app.set('views', __dirname + '/views');
    app.set('view engine', 'ejs');
    app.use(express.favicon());
    app.use(express.bodyParser());
    app.use(express.methodOverride());

    // app.use(express.static(path.join(__dirname, 'public'))); //example
    app.use('/img', express.static(__dirname + '/assets/img'));
    app.use('/fonts', express.static(__dirname + '/assets/fonts'));

    app.use(app.router);
    app.use(connect_assets());

  }
Пример #14
0
app.configure(function () {

    app.set('views', path.join(__dirname, 'views'));
    app.set('view engine', 'jade');
    app.use(connectAssets({
        paths: ['public/css', 'public/js'],
        helperContext: app.locals
    }));

    // set up our express application
    app.use(express.logger('dev')); // log every request to the console
    app.use(express.cookieParser()); // read cookies (needed for auth)
    app.use(express.bodyParser()); // get information from html forms
    app.use(express.json());

    // required for passport
    app.use(express.session({ secret: 'sears-israel-mobile-team-roles' })); // session secret
    app.use(flash()); // use connect-flash for flash messages stored in session

    app.use(app.router);
    app.use(express.static(path.join(__dirname, 'public'), { maxAge: week }));
    app.use(express.errorHandler());

});
Пример #15
0
app.get('/assets/scripts/preinit.js', browserify(__dirname + '/assets/scripts/preinit.js', {
  cache: true,
  precompile: true,
  transform: [[{ presets: ['es2015'] }, babelify]]
}))
app.get('/assets/scripts/main.js', browserify(__dirname + '/assets/scripts/main.js', {
  cache: true,
  precompile: true,
  transform: [[{ presets: ['es2015'] }, babelify]],
  external: [__dirname + '/assets/scripts/preinit.js']
}))

// Build JavaScript bundle via concatenation
// Deprecated. Remove after scripts moved to browserify
app.use(assets({
  paths: ['assets/js'],
  precompile: ['app.js']
}))

app.get('/assets/images/icons.svg', function (req, res) {
  res.sendFile(path.join(__dirname, '/node_modules/streetmix-icons/dist/icons.svg'))
})

app.use(express.static(path.join(__dirname, '/public')))

// Catch-all
app.use(function (req, res) {
  res.render('main', {})
})

// Provide a message after a Ctrl-C
// Note: various sources tell us that this does not work on Windows
Пример #16
0
    if(lang === 'none') {
      return code;
    }
    else if(lang === undefined) {
      return hljs.highlightAuto(code).value;
    } 
    else {
      return hljs.highlight(lang, code).value;
    }
  }
});


// App configuration
// -----------------
app.set( 'views', __dirname + '/views' )
app.set( 'view engine', 'jade' )
app.use( express.logger('dev') )
app.use( express.static(__dirname + '/public') )
app.use( function(req, res, next) { res.locals.site = config.site; next(); } )
app.use( assets({buildDir: 'public'}) )


// App routes
// ----------
require('./routes').init(app)


// Start server
// ------------
app.listen(process.env.PORT || 5000)
Пример #17
0
app.configure(function () {
  app.set('views', __dirname + '/client/interface');
  app.set('view engine', 'jade');
  app.use( connectAssets({src: "client"}))
});
Пример #18
0
});

/**
 * Express configuration.
 */

var hour = 3600000;
var day = (hour * 24);
var month = (day * 30);

app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.engine('ejs', ejslocals);
app.set('view engine', 'ejs');
app.use(connectAssets({
  paths: ['public/css', 'public/js'],
  helperContext: app.locals
}));
app.use(express.compress());
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.cookieParser());
app.use(express.json());
app.use(express.urlencoded());
app.use(expressValidator());
app.use(express.methodOverride());
app.use(express.session({
  secret: secrets.sessionSecret,
  store: new MongoStore({
    url: secrets.db,
    auto_reconnect: true
  })
Пример #19
0
module.exports = function (app, passport) {

  // Static files middleware
  app.use(express.static(config.root + '/public'));

  // Use winston on production
  var log;
  if (env !== 'development') {
    log = {
      stream: {
        write: function (message, encoding) {
          winston.info(message);
        }
      }
    };
  } else {
    log = 'dev';
  }

  // Don't log during tests
  // Logging middleware
  if (env !== 'test') app.use(morgan(log));

  // Swig templating engine settings
  if (env === 'development' || env === 'test') {
    swig.setDefaults({
      cache: false
    });
  }

  // set views path, template engine and default layout
  app.engine('html', swig.renderFile);
  app.set('views', config.root + '/app/views');
  app.set('view engine', 'html');
  app.use(connectAssets({
    paths: [path.join(config.root, 'public/css'), path.join(config.root, 'public/js')],
    helperContext: app.locals
  }));

  // expose package.json to views
  app.use(function (req, res, next) {
    res.locals.pkg = pkg;
    res.locals.env = env;
    next();
  });

  // bodyParser should be above methodOverride
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  
  app.use(methodOverride(function (req, res) {
    if (req.body && typeof req.body === 'object' && '_method' in req.body) {
      // look in urlencoded POST bodies and delete it
      var method = req.body._method;
      delete req.body._method;
      return method;
    }
  }));

  app.use(cookieParser());
  app.use(cookieSession({ secret: 'getAwesomeness rocks secret' }));
  
  // should be declared after session and flash
  app.use(helpers(pkg.name));
  app.use(uihelpers(pkg.name));
};
Пример #20
0
var app = express();
app.set('port', process.env.PORT || 3000);
app.set("views", path.join(__dirname, 'views'));
app.set("view engine", "jade");
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride());
app.use(cookieParser());
app.use(cookieSession({ keys: ['adf19dfe1a4bbdd949326870e3997d799b758b9b'] }));
app.use(logger('dev'));
app.use( function(req, res, next) {
  res.locals.session = req.session;
  return next();
});
app.use(assets());
app.use('/public', express["static"](path.join(__dirname, "public")));
app.use(function(req, res, next) {
  if (req.is('text/*')) {
    req.text = '';
    req.setEncoding('utf8');
    req.on('data', function(chunk) {
      return req.text += chunk;
    });
    return req.on('end', next);
  } else {
    return next();
  }
});

jade.filters.some = function(block, args) {
Пример #21
0
module.exports = function() {
  // Warn of version mismatch between global "lcm" binary and local installation
  // of Locomotive.
  if (this.version !== require('locomotive').version) {
    console.warn(util.format('version mismatch between local (%s) and global (%s) Locomotive module', require('locomotive').version, this.version));
  }

  // Configure application settings.  Consult the Express API Reference for a
  // list of the available [settings](http://expressjs.com/api.html#app-settings).
  this.set('views', __dirname + '/../../app/views');
  //this.set('view engine', 'ejs');
  //this.set('view engine', 'jade');


  // Register EJS as a template engine.
  //this.engine('ejs', require('ejs').__express);



  // Override default template extension.  By default, Locomotive finds
  // templates using the `name.format.engine` convention, for example
  // `index.html.ejs`  For some template engines, such as Jade, that find
  // layouts using a `layout.engine` notation, this results in mixed conventions
  // that can cuase confusion.  If this occurs, you can map an explicit
  // extension to a format.
  /* this.format('html', { extension: '.jade' }) */

  // Register formats for content negotiation.  Using content negotiation,
  // different formats can be served as needed by different clients.  For
  // example, a browser is sent an HTML response, while an API client is sent a
  // JSON or XML response.
  /* this.format('xml', { engine: 'xmlb' }); */

  // Use middleware.  Standard [Connect](http://www.senchalabs.org/connect/)
  // middleware is built-in, with additional [third-party](https://github.com/senchalabs/connect/wiki)
  // middleware available as separate modules.
  this.use(poweredBy('Locomotive'));
  this.use(express.logger());
  this.use(express.favicon());
  this.use(express.static(__dirname + '/../../public'));

  this.use(express.cookieParser());
 
  
  //converts to json if text, for the body parser
  this.use(function(req,res,next){
	
	if(req.is('text/*') )
	{
		req.headers['content-type'] = 'application/json; charset=UTF-8'
	}  
	next();
  })


  this.use(express.bodyParser());

  
  this.use(express.methodOverride());
  this.use(express.session({ secret: 'sa sad',    store: mongooseSessionStore }));
  this.use(flash());
  //this.use(connectTimeout({ time: 6000000 }))

  this.use (connectAsset({build: false,src:'public'})); 

  this.use(passport.initialize());
  this.use(passport.session());


  this.use(this.router);
  this.use(express.static(__dirname + '/../../public'));
  //this.use(express.static(__dirname + '/../../assets'));
  this.datastore(require('locomotive-mongoose'));


}
var cookieParser = require('cookie-parser');
var flash = require('connect-flash');
var bodyParser = require('body-parser');

var app = module.exports = express();
var assets = require('connect-assets');

require('./models');

app.set('view engine', 'jade');
app.set('views', `${__dirname}/views`);

app.use(assets({
  paths: [
    `${__dirname}/assets/javascripts`,
    `${__dirname}/assets/stylesheets`
  ],
  helperContext: app.locals
}));
app.use(cookieParser('keyboard cat'));
app.use(session({
  secret: 'keyboard cat',
  resave: true,
  saveUninitialized: true
}));

app.use(bodyParser.urlencoded({ extended: true }));
app.use(require('method-override')('_method'));

// Tighten security using paypals lusca.
app.use(lusca({
Пример #23
0
var ConnectAssets = require('connect-assets');
var STATIC_DIR = __dirname + '/../static';

ConnectAssets.cssCompilers.less.compress = (CONFIG.ENV === CONFIG.DOMAINS.PROD);

module.exports = ConnectAssets({
    src : STATIC_DIR,
    buildDir : false,
    build : (CONFIG.ENV === CONFIG.DOMAINS.PROD),
    minifyBuilds : (CONFIG.ENV === CONFIG.DOMAINS.PROD)
});
Пример #24
0
		{dir:'views/partials'},
		{dir:'views/server/partials', namespace: 'srv'}
	],
	helpers: _.extend(
		hbsHelpers,
		diyHbsHelpers,
		templateCache.helper()
	)
})
app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars');

app.use(compress())
app.use(connectAssets({
	paths: [
		fsPath.join(__dirname, 'browser/style')
	],
	helperContext: app.locals
}));

app.use(morgan(process.env.NODE_ENV === 'production' ? 'combined' : 'dev'));
app.use(bodyParser.json({
	limit: 1024 * 1024 * 128
}));
app.use(bodyParser.urlencoded( {
	extended: true,
	limit: 1024 * 1024 * 128
}));
app.use(expressValidator());
app.use(methodOverride());

app.use(cookieParser());
Пример #25
0
    'MongoDB Connection Error. Please make sure that MongoDB is running.'
  );
});

/**
 * Express configuration.
 */

app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(compress());
app.use(connectAssets({
    paths: [
      path.join(__dirname, 'public/css'),
      path.join(__dirname, 'public/js')
    ],
    helperContext: app.locals
}));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(expressValidator({
    customValidators: {
        matchRegex: function(param, regex) {
            return regex.test(param);
        }
    }
}));
app.use(methodOverride());
app.use(cookieParser());
Пример #26
0
Файл: app.js Проект: Sinar/popit
    popitApiStorageSelector = require('popit-api/src/middleware/storage-selector'),
    passport          = require('../lib/passport'),
    bodyParser        = require('body-parser'),
    multer            = require('multer');

var app = module.exports = express();

app.enable('trust proxy');

setupTemplates(app, __dirname + '/views');

app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(multer());
app.use(express.methodOverride());
app.use(assets({ paths: [ config.public_dir + '/js', config.public_dir + '/css' ] }));

app.use(passport.initialize());
app.use(passport.session());

app.use(require('../lib/authorization').middleware());

app.use( require('../lib/middleware/config') );
app.use(instanceSelector());
app.use(checkInstanceAvailable());
app.use(popitApiStorageSelector({
  storageSelector: 'popit',
  databasePrefix: config.MongoDB.popit_prefix
}));

app.use( require('../lib/middleware/disclaimer') );
Пример #27
0
var express  = require('express');
var http     = require('http');
var assets   = require('connect-assets');
var mongoose = require('mongoose');
var app      = express();

app.use(assets({ src: 'client' }));

css.root = 'styles';

app.configure(function() {
	app.set('port', process.env.PORT || 4000);
	app.set('views', 'client/views');
	app.set('view engine', 'jade');
	app.use(express.bodyParser());
	app.locals.pretty = true;
	app.use(express['static']('client'));
	app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));

	app.use(express.logger('dev'));
});

require('./routes').init(app);

http.createServer(app).listen(app.get('port'), function() {
	return console.log('Express server listening on port ' + app.get('port'));
});
Пример #28
0
 */

var csrfExclude = ['/url1', '/url2'];

/**
 * Express configuration.
 */

app.set('port', process.env.PORT || 3000);

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(compress());
app.use(connectAssets({
  paths: [path.join(__dirname, 'public/compiled/stylesheets'), path.join(__dirname, 'public/compiled/javascripts')],
  helperContext: app.locals
}))
app.use(favicon());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(session({
  resave: true,
  saveUninitialized: true,
  secret: 'purple monkey dishwasher',
}));
app.use(flash());
app.use(passport.initialize());
app.use(passport.session());
app.use(function(req, res, next) {
Пример #29
0
/**
 * CSRF whitelist.
 */

// var csrfExclude = ['/checkin'];

/**
 * Express configuration.
 */

app.set('port', process.env.OPENSHIFT_DIY_PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(compress());
app.use(connectAssets({
  paths: [path.join(__dirname, 'public/css'), path.join(__dirname, 'public/js')]
}));

var log_opts = process.env.OPENSHIFT_LOG_DIR
  ? { stream: fs.createWriteStream(process.env.OPENSHIFT_LOG_DIR + '/app.log', { flags: 'a'}) }
  : {}
app.use(logger('dev', log_opts));
// app.use(bodyParser.json());
// app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(expressValidator());
app.use(methodOverride());
app.use(cookieParser());
app.use(session({
  resave: true,
Пример #30
0
var app = express();

/**
 * Express configuration.
 */
app.set('port', config.get('PORT'));
app.set('env', config.get('NODE_ENV') || 'dev');
app.set('views', toFull('../views'));
app.set('view engine', 'jade');
if (app.get('env') === 'dev') {
  // render indented HTML in dev mode
  app.locals.pretty = true;
}
app.use(compress());
app.use(connectAssets({
  paths: [toFull('../public/css'), toFull('../public/js')]
}));
app.use(logger(config.get('NODE_ENV')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(multer({ dest: toFull('../uploads') }));
app.use(expressValidator());
app.use(methodOverride());
app.use(cookieParser());
app.use(session({
  resave: true,
  saveUninitialized: true,
  secret: config.get('sessionSecret'),
  store: new FileStore()
}));
app.use(passport.initialize());