Skip to content

Stop using methods to generate methods #129

@blakeembrey

Description

@blakeembrey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions