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

doc: fix inconsistent documentation of server.listen() #16020

Closed
wants to merge 4 commits into from

Conversation

mgjm
Copy link
Contributor

@mgjm mgjm commented Oct 6, 2017

First commit:
The net, tls, http and https module have the same
server.listen() method, but have a different documenation.
Changed to a consistent link to the documentation of the net module.

Fixes #11915

Second commit:
The https.createServer() function is above some https.Server
methods. Move server.close() and server.listen() to the correct
position.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.
The `https.createServer()` function is above some `https.Server`
methods. Move `server.close()` and `server.listen()` to the correct
position.
@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Oct 6, 2017
@mscdex mscdex added http Issues or PRs related to the http subsystem. https Issues or PRs related to the https subsystem. tls Issues and PRs related to the tls subsystem. labels Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 7, 2017
@Trott
Copy link
Member

Trott commented Oct 10, 2017

Ping @nodejs/documentation: Can we get some reviews for this?

doc/api/http.md Outdated
*Note*: The `server.listen()` method can be called again if and only if there was an error
during the first `server.listen()` call or `server.close()` has been called.
Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
Start a server listening for connections. This method is identical to [`server.listen()`][] from [`net.Server`][].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't put this as

This method is identical to [`server.listen()`][] from [`net.Server`][].

because it starts a HTTP server, not a bare TCP/IPC server. IMO a better way to put this would be something like:

Starts the HTTP server listening for connections.
This method has the same signatures as [`server.listen()`][] from [`net.Server`][].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the two methods are equal net.Server.prototype.listen === http.Server.prototype.listen. So a compromise would be:

Starts the HTTP server listening for connections.
This method is identical to [`server.listen()`][] from [`net.Server`][].

doc/api/https.md Outdated
-->
- `callback` {Function}

See [`http.close()`][] for details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http.close() is a little bit ambiguous. Maybe

See [`server.close()`][`http.close()`] from the HTTP module for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only moved the description of http.close() to another location. But it would be a nice change to make the description better.

@lpinca
Copy link
Member

lpinca commented Oct 14, 2017

@mgjm can you please address @joyeecheung comments?. Also please break lines at 80 chars.

The different server.listen() methods are all the same function but
result in different servers listening for connections.
This fact is now also documented.
The documentation of `server.close()` in the https module only links
to the documentation in the http module and is a bit ambiguous.
Changed the documentation in the https module to clarify the relation.
@mgjm
Copy link
Contributor Author

mgjm commented Oct 14, 2017

Sorry for the delay.
I just made the changes according to my comments and pushed the changes to my branch.
Do i need to create a new pull request or something else?

@lpinca
Copy link
Member

lpinca commented Oct 14, 2017

@mgjm no this is perfect.

@lpinca
Copy link
Member

lpinca commented Oct 14, 2017

@bengl @sam-github @joyeecheung PTAL.

@@ -1963,6 +1888,7 @@ const req = http.request(options, (res) => {
[`net.Server.listen(path)`]: net.html#net_server_listen_path_backlog_callback
[`net.Server.listen(port)`]: net.html#net_server_listen_port_host_backlog_callback
[`net.Server`]: net.html#net_class_net_server
[`server.listen()`]: net.html#net_server_listen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these should be in the sorted order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not certain if there is a lint rule for things like this but this would be pretty neat!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to address this in another PR and write some automation / linting to check for the order of the documented methods as well as the order of the links

@BridgeAR BridgeAR self-assigned this Oct 18, 2017
@bengl
Copy link
Member

bengl commented Oct 18, 2017

still LGTM

BridgeAR pushed a commit that referenced this pull request Oct 19, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: #16020
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@BridgeAR
Copy link
Member

Landed in 278f653

Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 !

@MylesBorins
Copy link
Contributor

hey @nodejs/collaborators would someone be willing to backport this to v8.x-staging?

lpinca pushed a commit to lpinca/node that referenced this pull request Oct 24, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: nodejs#16020
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 26, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: nodejs/node#16020
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: #16020
Backport-PR-URL: #16435
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: #16020
Backport-PR-URL: #16435
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
The `net`, `tls`, `http` and `https` module have the same
`server.listen()` method, but have a different documenation.
Changed to a consistent link to the documentation of the `net` module.

PR-URL: nodejs/node#16020
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@codebytere
Copy link
Member

Currently working through some backports & since this appears to have been backported to v8.x already we may want to remove the backport-requested-v8.x label :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. https Issues or PRs related to the https subsystem. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document tls.Server#listen(path, callback) and possible other signatures