-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: Stabilize Deno.serve() API #19141
Conversation
The actual PR LGTM. One thing I am concerned about is the type signature of the method. I don't recall another API in which the options argument is first. iirc there was a PR to remove this option, but perhaps |
IIRC no other |
That reasoning makes sense to me, thanks for clarifying! |
Also, there is precedent for options bag first: |
Doh, of course |
I have to postpone this PR due to #19189. |
@lucacasonato pointed out some documentation issues -- I compared the current version of the HTTP server docs with what will be required. For the most part we should be able to swap out |
A few questions:
|
Sure, we can change it to be 8000.
We discussed overloads two months ago and already removed some of them. @lucacasonato was rather adamant on keeping these 3. |
unref(): void; | ||
} | ||
|
||
/** Serves HTTP requests with the given handler. |
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.
these docs are repeated for each overload?
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 think that's a requirement for deno_doc
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.
Maybe each doc should be specific to the overload? Or maybe we should just consider that a bug in deno_doc and do what makes sense in the d.ts file. It does not make sense to duplicate documentation three times - so there's definitely a bug here (either in deno_doc or jsdoc spec)
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.
CC @dsherret @crowlKats do you remember the reason why this was needed? Can we somehow flatten all three overloads to be next to each other with only a single doc?
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.
a doc block is specific to its overload; there is no way to specify a single doc for all overloads. unsure how we could change this, as it is favourable to have the capability to document overloads differently from each other.
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've updated the docs so that each overload has a different doc string.
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.
LGTM. Great work to everyone involved!
Let's make sure to update the manual after this lands.
Line 174 in 686ec85
$ deno --version
deno 1.34.3+686ec85 (canary, x86_64-apple-darwin)
v8 11.6.189.7
typescript 5.1.6
$ deno eval 'console.log(Deno.serve)'
undefined
$ deno eval --unstable 'console.log(Deno.serve)'
[Function: serve] |
Wow, thanks for pointing this out @0f-0b, fix incoming. |
No description provided.