Last active
August 29, 2015 14:00
-
-
Save jmervine/e20757e2c0e9e7d2ecb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... app.js ... | |
// | |
// In the below examples replace 'development' (and 'production') with | |
// the actual NODE_ENV passed, for example we use 'dev' for development | |
// and 'prod' for production. | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
if (process.env.NODE_ENV === 'development') { | |
app.set('view cache', false); | |
} else { | |
app.set('view cache', true); | |
} | |
// NOTE: Searching for this, most results will produce the older way of doing this. | |
// This is no longer the recommended way because 'app.configure' is removed in | |
// Express 4.x, and if you haven't already, I recommend upgrading to it before | |
// releasing or ASAP if you've already released. | |
// | |
// The old way: | |
app.configure(function() { | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
}); | |
app.configure('production', function() { | |
app.set('view cache', true); | |
}); | |
app.configure('development', function() { | |
app.set('view cache', false); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment