Skip to content

Instantly share code, notes, and snippets.

@ramontristani
Last active August 29, 2015 13:56
Show Gist options
  • Save ramontristani/9203629 to your computer and use it in GitHub Desktop.
Save ramontristani/9203629 to your computer and use it in GitHub Desktop.
Express application configuration
module.exports = function(express, path, app) {
var root = path.normalize(__dirname + '../../../');
app.configure(function() {
app.use(express.logger('dev')); // log all requests to the console
app.use(express.cookieParser()); // enable reading of cookies
app.use(express.json({ limit: '50mb' })); // set json request payload size
app.use(express.urlencoded({ limit: '50mb' })); // set query request payload size
app.use(express.static(path.join(root, 'public'))); // set relative site root
app.set('views', path.join(root, 'views')); // set view path
app.set('view engine', 'ejs'); // set EJS as templating engine
process.env.port = process.env.port = process.env.port || 3000;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment