Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using methods to generate methods #129

Open
blakeembrey opened this issue Oct 22, 2024 · 1 comment
Open

Stop using methods to generate methods #129

blakeembrey opened this issue Oct 22, 2024 · 1 comment

Comments

@blakeembrey
Copy link
Member

For the next major I think we should consider removing the autogenerated methods from here:

router/index.js

Lines 436 to 443 in 36ae18f

// create Router#VERB functions
methods.concat('all').forEach(function (method) {
Router.prototype[method] = function (path) {
const route = this.route(path)
route[method].apply(route, slice.call(arguments, 1))
return this
}
})
.

We can provide the main ones statically, and instead rely on a new router.method("METHOD", ...) for the obscure ones. The main reason is to avoid confusion arounds methods such as BIND, which overwrote the JavaScript .bind property, which created a number of bug reports in Express 4.

@jonkoops
Copy link
Contributor

jonkoops commented Nov 5, 2024

Perhaps we should set up a milestone for the next major so we can keep track of all the issue that should go into it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants