and just do app.viewEngine= and stuff instead
Why?
app.get serves a double purpose of adding routes and getting settings. Maybe we can go the cleaner route of
// to set
app.settings('foo bar', 'value for foo bar');
// to get
app.settings('foo bar');
Otherwise, I too want to know the reason for removing. App level settings is a nice place to configure some things.
I don't like the double purposijg of app.get(). settings() will work, but at that point we should just make settings an object and let people overwrite it with their own config system
The main thing I want to do is stop people from using express' configuration system for everything
The main thing I want to do is stop people from using express' configuration system for everything
Why?
Why do you want to do that?
because express is an app framework, not a configuration framework. the number of options should be minimal and should only be used for express-specific options. otherwise, you should set the options yourself using another module or file.
i've seen issues on stackoverflow where people advocate using app.get() and app.set() for non-express related options when they could more easily just create a options.js file. this is more an issue for beginners since more advanced already know they need better configuration handling.
Agreed with Jon and Roman.
My suggestion would be to use a single interface / property to set the
configurations (e.g.: app.settings or app.settings()).
On Jul 7, 2014 9:00 AM, "Jonathan Ong" [email protected] wrote:
because express is an app framework, not a configuration framework. the
number of options should be minimal and should only be used for
express-specific options. otherwise, you should set the options yourself
using another module or file.i've seen issues on stackoverflow where people advocate using app.get()
and app.set() for non-express related options when they could more easily
just create a options.js file. this is more an issue for beginners since
more advanced already know they need better configuration handling.—
Reply to this email directly or view it on GitHub
https://github.com/visionmedia/express/issues/2216#issuecomment-48138196
.
It is true that when I first started to use Express, this function kinda threw me off.
Maybe we could just namespace it; app.settings.set({string}, {*}) app.settings.get({string}) and event let app.settings({string}, [{string}])as a shortcut.
Thinking of something like this:
app.settings = function () {
if (arguments.length === 1) return app.settings.set.apply(app.settings, arguments);
else if (arguments.length === 2) return app.settings.get.apply(app.settings, arguments);
}
app.settings.set = function (name, value) { /** ... **/ }
app.settings.get = function (name) { /** ... **/ }
Hey all, I created a pull request to solve this issue. It passes all the tests. Let me know if you have questions :) https://github.com/strongloop/express/pull/2267
Everything is probably going to be configured via options objects 5.x fwiw
@dougwilson should we already deprecate in 4.x?
should we already deprecate in 4.x?
No, because we cannot deprecate something without an alternative method :) There are not alternatives for tuning some of the Express internals besides app.set(name, val) right now. But even then, it would be super annoying :)