Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
interface Deno.ServeOptions

Options which can be set when calling Deno.serve.


port: number = 8000

The port to listen on.

hostname: string = ""

A literal IP address or host name that can be resolved to an IP address.

Note about While listening works on all platforms, the browsers on Windows don't work with the address You should show the message like server running on localhost:8080 instead of server running on if your program supports Windows.

signal: AbortSignal

An AbortSignal to close the server and all connections.

reusePort: boolean

Sets SO_REUSEPORT on POSIX systems.

onError: (error: unknown) => Response | Promise<Response>

The handler to invoke when route handlers throw an error.

onListen: (params: { hostname: string; port: number; }) => void

The callback which is called when the server starts listening.