using two spaces for tabs

This commit is contained in:
Mario Colque 2014-01-06 14:37:32 -03:00
parent 79e6cdfffd
commit e33ee06cc6
9 changed files with 84 additions and 84 deletions

View File

@ -1,5 +1,5 @@
'use strict';
exports.render = function(req, res) {
res.render('index');
res.render('index');
};

View File

@ -5,5 +5,5 @@ var _ = require('lodash');
// Load app configuration
module.exports = _.extend(
require(__dirname + '/../config/env/all.js'),
require(__dirname + '/../config/env/' + process.env.NODE_ENV + '.js') || {});
require(__dirname + '/../config/env/all.js'),
require(__dirname + '/../config/env/' + process.env.NODE_ENV + '.js') || {});

6
config/env/all.js vendored
View File

@ -4,7 +4,7 @@ var path = require('path'),
rootPath = path.normalize(__dirname + '/../..');
module.exports = {
root: rootPath,
port: process.env.PORT || 3000,
db: process.env.MONGOHQ_URL
root: rootPath,
port: process.env.PORT || 3000,
db: process.env.MONGOHQ_URL
}

View File

@ -1,8 +1,8 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mystery-dev",
app: {
name: "Mystery - Development"
}
db: "mongodb://localhost/mystery-dev",
app: {
name: "Mystery - Development"
}
}

View File

@ -1,8 +1,8 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mystery",
app: {
name: "Mystery - Production"
}
db: "mongodb://localhost/mystery",
app: {
name: "Mystery - Production"
}
}

10
config/env/test.js vendored
View File

@ -1,9 +1,9 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mystery-test",
port: 3001,
app: {
name: "Mystery - Test"
}
db: "mongodb://localhost/mystery-test",
port: 3001,
app: {
name: "Mystery - Test"
}
}

View File

@ -4,66 +4,66 @@
* Module dependencies.
*/
var express = require('express'),
config = require('./config');
config = require('./config');
module.exports = function(app, passport, db) {
app.set('showStackError', true);
app.set('showStackError', true);
//Prettify HTML
app.locals.pretty = true;
//Prettify HTML
app.locals.pretty = true;
//Should be placed before express.static
app.use(express.compress({
filter: function(req, res) {
return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
},
level: 9
}));
//Should be placed before express.static
app.use(express.compress({
filter: function(req, res) {
return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
},
level: 9
}));
//Set views path, template engine and default layout
app.set('views', config.root + '/app/views');
app.set('view engine', 'jade');
//Set views path, template engine and default layout
app.set('views', config.root + '/app/views');
app.set('view engine', 'jade');
//Enable jsonp
app.enable("jsonp callback");
//Enable jsonp
app.enable("jsonp callback");
app.configure(function() {
//cookieParser should be above session
app.use(express.cookieParser());
app.configure(function() {
//cookieParser should be above session
app.use(express.cookieParser());
// request body parsing middleware should be above methodOverride
app.use(express.urlencoded());
app.use(express.json());
app.use(express.methodOverride());
// request body parsing middleware should be above methodOverride
app.use(express.urlencoded());
app.use(express.json());
app.use(express.methodOverride());
//routes should be at the last
app.use(app.router);
//Setting the fav icon and static folder
app.use(express.favicon());
app.use(express.static(config.root + '/public'));
//routes should be at the last
app.use(app.router);
//Assume "not found" in the error msgs is a 404. this is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
app.use(function(err, req, res, next) {
//Treat as 404
if (~err.message.indexOf('not found')) return next();
//Setting the fav icon and static folder
app.use(express.favicon());
app.use(express.static(config.root + '/public'));
//Log it
console.error(err.stack);
//Assume "not found" in the error msgs is a 404. this is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
app.use(function(err, req, res, next) {
//Treat as 404
if (~err.message.indexOf('not found')) return next();
//Error page
res.status(500).render('500', {
error: err.stack
});
});
//Assume 404 since no middleware responded
app.use(function(req, res, next) {
res.status(404).render('404', {
url: req.originalUrl,
error: 'Not found'
});
});
//Log it
console.error(err.stack);
//Error page
res.status(500).render('500', {
error: err.stack
});
});
//Assume 404 since no middleware responded
app.use(function(req, res, next) {
res.status(404).render('404', {
url: req.originalUrl,
error: 'Not found'
});
});
});
};

View File

@ -2,8 +2,8 @@
module.exports = function(app) {
//Home route
var index = require('../app/controllers/index');
app.get('/', index.render);
//Home route
var index = require('../app/controllers/index');
app.get('/', index.render);
};

View File

@ -4,7 +4,7 @@
* Module dependencies.
*/
var express = require('express'),
fs = require('fs');
fs = require('fs');
/**
* Main application entry file.
@ -14,9 +14,9 @@ var express = require('express'),
//Set the node enviornment variable if not set before
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
//Initializing system variables
//Initializing system variables
var config = require('./config/config'),
mongoose = require('mongoose');
mongoose = require('mongoose');
//Bootstrap db connection
var db = mongoose.connect(config.db);
@ -24,17 +24,17 @@ var db = mongoose.connect(config.db);
//Bootstrap models
var models_path = __dirname + '/app/models';
var walk = function(path) {
fs.readdirSync(path).forEach(function(file) {
var newPath = path + '/' + file;
var stat = fs.statSync(newPath);
if (stat.isFile()) {
if (/(.*)\.(js$|coffee$)/.test(file)) {
require(newPath);
}
} else if (stat.isDirectory()) {
walk(newPath);
}
});
fs.readdirSync(path).forEach(function(file) {
var newPath = path + '/' + file;
var stat = fs.statSync(newPath);
if (stat.isFile()) {
if (/(.*)\.(js$|coffee$)/.test(file)) {
require(newPath);
}
} else if (stat.isDirectory()) {
walk(newPath);
}
});
};
walk(models_path);