Change the interface for setting application settings

Open
#4,099 5 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
api, backend

Research direction

Start by tracing the existing app.set(, ) and app.get() interfaces, including their overlap with the router form of app.get(path, callback). Define the scope for app.settings getter-setter behavior and the major-version removal of the settings form, then verify the resulting interface and compatibility expectations in the relevant tests.

Written by the indexing model from the issue text.

Description

5.x enhancement

The interface app.set(<name with space>, <value>) feels a odd for setting values in a JavaScript framework. Also, its counterpart app.get(<name>) is a confusing twin of app.get(path, callback [, callback ...]), which is a router method.

I am proposing to implement application settings using getter-setter interfaces.

app.settings.trustProxy = true;

And get rid of app.get(<name>).

Super major change, I know, but the next major version is a good time to make these interface improvements.

Related issues

  1. https://github.com/expressjs/express/issues/2216
  2. https://github.com/expressjs/express/issues/3997
Dominant language
JavaScript
Stars
69.7k
Forks
25.6k
Avg merge
2d 9h
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/express

All issues in expressjs/express

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.