-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Conversation
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.
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`][]. |
There was a problem hiding this comment.
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`][].
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@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.
Sorry for the delay. |
@mgjm no this is perfect. |
@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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
still LGTM |
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Landed in 278f653 Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 ! |
hey @nodejs/collaborators would someone be willing to backport this to v8.x-staging? |
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
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 <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Currently working through some backports & since this appears to have been backported to |
First commit:
The
net
,tls
,http
andhttps
module have the sameserver.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 somehttps.Server
methods. Move
server.close()
andserver.listen()
to the correctposition.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)