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

std/http: add serveTLS and listenAndServeTLS #3257

Merged
merged 4 commits into from
Nov 4, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Drop transport key from serveTLS options
  • Loading branch information
kevinkassimo committed Nov 4, 2019
commit c28bac0a1c673e58829285dcc0a9223f9bcb3284
12 changes: 9 additions & 3 deletions std/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,19 @@ export async function listenAndServe(
}
}

export function serveTLS(options: Deno.ListenTLSOptions): Server {
const listener = listenTLS(options);
export type HTTPSOptions = Omit<Deno.ListenTLSOptions, "transport">;

export function serveTLS(options: HTTPSOptions): Server {
Copy link
Member

@ry ry Nov 4, 2019

Choose a reason for hiding this comment

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

Can you add a jsdoc with a little example?

We have a documentation viewer now - so it will be visible at https://deno.land/std/http/server.ts?doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

const tlsOptions: Deno.ListenTLSOptions = {
...options,
transport: "tcp"
};
const listener = listenTLS(tlsOptions);
return new Server(listener);
}

export async function listenAndServeTLS(
options: Deno.ListenTLSOptions,
options: HTTPSOptions,
handler: (req: ServerRequest) => void
): Promise<void> {
const server = serveTLS(options);
Expand Down