|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var express = require('express')
|
|
|
|
, round = require('./routes/round')
|
|
|
|
, http = require('http')
|
|
|
|
, path = require('path')
|
|
|
|
, cons = require('consolidate')
|
|
|
|
, swig = require('swig');
|
|
|
|
|
|
|
|
var app = express();
|
|
|
|
|
|
|
|
// all environments
|
|
|
|
app.engine('.html', cons.swig)
|
|
|
|
swig.init({
|
|
|
|
root: path.join(__dirname, 'views'),
|
|
|
|
cache: false,
|
|
|
|
allowErrors: true
|
|
|
|
})
|
|
|
|
|
|
|
|
app.set('port', process.env.PORT || 3000);
|
|
|
|
app.set('views', path.join(__dirname, 'views'));
|
|
|
|
app.set('view engine', 'html');
|
|
|
|
app.use(express.favicon());
|
|
|
|
app.use(express.logger('dev'));
|
|
|
|
app.use(express.bodyParser());
|
|
|
|
app.use(express.methodOverride());
|
|
|
|
app.use(app.router);
|
|
|
|
app.use('/static', express.static(path.join(__dirname, 'public')));
|
|
|
|
|
|
|
|
// development only
|
|
|
|
if ('development' == app.get('env')) {
|
|
|
|
app.use(express.errorHandler());
|
|
|
|
}
|
|
|
|
|
|
|
|
app.get('/', round.index);
|
|
|
|
|
|
|
|
http.createServer(app).listen(app.get('port'), function(){
|
|
|
|
console.log('Express server listening on port ' + app.get('port'));
|
|
|
|
});
|