feat: rename Deno.Server to Deno.HttpServer (#20842)

Keeps the old name around for backwards compat.

Closes #20840
This commit is contained in:
Luca Casonato 2023-10-27 14:35:31 +02:00 committed by GitHub
parent 33565e16ca
commit 9a97edce05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -5911,7 +5911,7 @@ declare namespace Deno {
*
* @category HTTP Server
*/
export interface Server {
export interface HttpServer {
/** A promise that resolves once server finishes - eg. when aborted using
* the signal passed to {@linkcode ServeOptions.signal}.
*/
@ -5929,6 +5929,12 @@ declare namespace Deno {
unref(): void;
}
/**
* @category HTTP Server
* @deprecated Use {@linkcode HttpServer} instead.
*/
export type Server = HttpServer;
/** Serves HTTP requests with the given handler.
*
* The below example serves with the port `8000` on hostname `"127.0.0.1"`.
@ -5939,7 +5945,7 @@ declare namespace Deno {
*
* @category HTTP Server
*/
export function serve(handler: ServeHandler): Server;
export function serve(handler: ServeHandler): HttpServer;
/** Serves HTTP requests with the given option bag and handler.
*
* You can specify an object with a port and hostname option, which is the
@ -5999,7 +6005,7 @@ declare namespace Deno {
export function serve(
options: ServeOptions | ServeTlsOptions,
handler: ServeHandler,
): Server;
): HttpServer;
/** Serves HTTP requests with the given option bag.
*
* You can specify an object with a port and hostname option, which is the
@ -6027,5 +6033,5 @@ declare namespace Deno {
*/
export function serve(
options: ServeInit & (ServeOptions | ServeTlsOptions),
): Server;
): HttpServer;
}

View file

@ -1941,7 +1941,7 @@ declare namespace Deno {
*
* @category HTTP Server
*/
export interface Server {
export interface HttpServer {
/** Gracefully close the server. No more new connections will be accepted,
* while pending requests will be allowed to finish.
*/