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

Clarify args accepted in docs for http.Server.listen #20142

Closed
wants to merge 1 commit into from

Conversation

musgravejw
Copy link
Contributor

@musgravejw musgravejw commented Apr 19, 2018

Additional documentation around http.Server.listen() argument list.

Closes #16300

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

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Apr 19, 2018
doc/api/http.md Outdated
@@ -920,6 +920,13 @@ Stops the server from accepting new connections. See [`net.Server.close()`][].
Starts the HTTP server listening for connections.
This method is identical to [`server.listen()`][] from [`net.Server`][].

Possible signatures:
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if it's makes sense as it is already linked to https://nodejs.org/dist/latest/docs/api/net.html#net_server_listen which list the possible signatures. However the last one can be improved. Should we change this PR and tackle that instead?

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 see your point, maybe we could move the spec discussion to this issue #16300.

Was you suggestion to add the last signature to net.Server.listen() instead?

Copy link
Member

@lpinca lpinca Apr 19, 2018

Choose a reason for hiding this comment

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

Yes, exactly. I'm proposing this basically because of 278f653.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that very different from the last signature in net.Server.listen()?

Perhaps the initial issue does not need to be addressed.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it's quite different because it makes it clear which parameters will be used in each scenario. The signature in net.Server.listen makes it seem like it's possible to leave out port & host and include backlog, but it's not actually. The signature @joyeecheung came up with is more precise.

doc/api/http.md Outdated
@@ -920,6 +920,13 @@ Stops the server from accepting new connections. See [`net.Server.close()`][].
Starts the HTTP server listening for connections.
This method is identical to [`server.listen()`][] from [`net.Server`][].

Possible signatures:

server.listen(handle[, backlog][, callback])
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this is not rendered very well, so maybe this can be formatted as a list or a code block in backticks if we decide to leave it here in this form.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, my mistake. Thanks.

@musgravejw musgravejw force-pushed the master branch 3 times, most recently from ca1e9c2 to 8518da5 Compare April 20, 2018 23:33
@musgravejw
Copy link
Contributor Author

@lpinca @apapirovski Updated commit based on discussion, does this capture the consensus?

@lpinca
Copy link
Member

lpinca commented Apr 21, 2018

LGTM, thank you.

doc/api/net.md Outdated
@@ -192,7 +192,7 @@ Possible signatures:
* [`server.listen(options[, callback])`][`server.listen(options)`]
* [`server.listen(path[, backlog][, callback])`][`server.listen(path)`]
for [IPC][] servers
* [`server.listen([port][, host][, backlog][, callback])`][`server.listen(port, host)`]
* [`server.listen([[[port[, hostname[, backlog]]][, callback])`]
Copy link
Member

@lpinca lpinca Apr 21, 2018

Choose a reason for hiding this comment

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

The trailing [`server.listen(port, host)`] part should not be removed though.

Copy link
Member

Choose a reason for hiding this comment

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

There is also another occurrence on line 267. Can you please also fix that?

@musgravejw
Copy link
Contributor Author

My mistake, updated the commit.

@lpinca
Copy link
Member

lpinca commented Apr 21, 2018

@lpinca lpinca added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 21, 2018
trivikr pushed a commit that referenced this pull request Apr 22, 2018
PR-URL: #20142
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@trivikr
Copy link
Member

trivikr commented Apr 22, 2018

Landed in 3cb8e64

Congratulations @musgravejw on your first commit to Node.js core! 🎉🎉🎉

@trivikr trivikr closed this Apr 22, 2018
@apapirovski
Copy link
Member

This shouldn't have landed yet... It didn't correct the instance it's linking to. Opening a PR to fix.

jasnell pushed a commit that referenced this pull request Apr 23, 2018
PR-URL: #20142
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs on http.Server.listen() need clarifications on accepted args
6 participants