Skip to content

5.x app.listen([port[, host[, backlog]]][, callback]) is not identical to Node’s http.Server.listen(). #2255

@ig3

Description

@ig3

Description

Documentation of app.listen([port[, host[, backlog]]][, callback]) states:

This method is identical to Node’s http.Server.listen().

However, this is not true. In particular, calls to the callback differ.

See, for example expressjs/express#6191.

The new behaviour is documented in the migration guide: https://expressjs.com/en/guide/migrating-5.html

But the 5.x app.listen documentation still incorrectly indicates the express function is identical to the node http.Server.listen() function and does not document the details of callback calling that are unique to Express 5.x. This makes it difficult to understand what is happening when there are errors from the server (e.g. port already in use), if one is not following the migration guide.

It would be helpful if the 5.x documentation was updated to remove the statement that Express' listen() is identical to nodes http.Server.listen() and to document the Express specific handling of the callback.

but the difference is not documented.

Expectations

The 5.x documentation of app.listen() should not state that app.listen() is identical to nodes' https.Server.listen() and it should document the Express specific handling of the callback arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions