ReadonlyidentifierA unique identifier for this server instance (UUID string).
Destroy this server, releasing all resources.
After calling destroy(), the server object should not be used.
Get the configured network interface, or null if listening on all interfaces.
The interface name or IP address string, or null.
Get the configured Bonjour service name.
The Bonjour service name.
Get the TCP port the server is currently listening on. Returns 0 if the server is not running.
The TCP port number.
Enable or disable directory listing for requests that map to a directory with no index file. When disabled (the default), directory requests without an index file return 403.
true to serve directory listings, false to return 403 (default).
This server, for chaining.
Enable or disable Bonjour advertisement of this server on the local network.
true to advertise via Bonjour, false to disable (default).
This server, for chaining.
Set the request handler callback.
If the callback returns null or undefined, the server falls through to static file serving
(if a document root is set), or responds with 404.
The request handler, or null to clear.
This server, for chaining.
Set the list of index filenames checked when a directory is requested.
Defaults to ["index.html", "index.htm"]. Files are checked in order.
Array of filename strings.
This server, for chaining.
Set the filesystem path to serve static files from.
When a document root is set, requests not handled by the callback are served as
static files from this directory. Pass null to disable static file serving.
Absolute path to a directory, or null to disable.
This server, for chaining.
Set the network interface to listen on.
Pass null to listen on all interfaces (the default). Pass "localhost" or "loopback"
to restrict to the loopback interface only.
Interface name or IP address string, or null for all interfaces.
This server, for chaining.
Set the maximum allowed incoming request body size in bytes. Requests with a body exceeding this limit receive a 413 response. Defaults to 10 MB.
Maximum body size in bytes.
This server, for chaining.
Set the Bonjour service name advertised on the local network.
Only used when Bonjour is enabled via setBonjour(true).
The Bonjour service name.
This server, for chaining.
Set a password required for Basic authentication.
When set, every request must supply an Authorization: Basic header with any
username and the configured password. Pass null to disable authentication.
The required password, or null to remove authentication.
This server, for chaining.
Set the TCP port to listen on. Must be called before start().
Pass 0 to let the OS assign an available port (use getPort() after start() to discover it).
TCP port number (0–65535).
This server, for chaining.
Configure TLS using a PKCS#12 (.p12) identity file.
When TLS is configured, the server accepts HTTPS connections. The .p12 file must
contain both the certificate and the private key.
Absolute path to the .p12 file.
The password protecting the .p12 file.
This server, for chaining.
Register a WebSocket handler for a URL path.
When a client connects and performs a WebSocket upgrade handshake on path, the callback
is invoked with three arguments: event (string), connection (HSWebSocketConnection),
and message (string).
Events:*
Pass null to remove the WebSocket handler for the path.
The URL path to handle WebSocket connections on (e.g. "/ws").
The event handler, or null to remove.
This server, for chaining.
Start the server and begin accepting connections.
The server must be configured before calling start(). To restart the server with new
settings, call stop() followed by start().
This server, for chaining.
An HTTP server instance created by
hs.httpserver.create(). Configure with chainable setter methods, then callstart()to begin accepting connections. The server supports synchronous and async (Promise-returning) request callbacks, optional static file serving, HTTP Basic authentication, Bonjour advertisement, and TLS via PKCS#12. Do not instantiateHSHTTPServerdirectly — usehs.httpserver.create().