We use cookies to improve your experience.

Cookie Policy
Logo of Lexmount
DocsTemplatesBlogHelp Center
GitHub
Logo of LexmountLexmount Browser

Get started

Lexmount Documentation
Console guide

Browser

Web Fetch

OverviewQuick Start
Common Errors

Web Search

OverviewQuick StartSearch API

Runtime

OverviewQuickstart
Overviewfetchlexmount:env
Overviewhost.fshost.fetchhost.processhost.tcphost.http
lexmount:browser
Examples

Help and billing

Capability FAQ
ChangelogContact support
API Referencelexmount:remote

host.http

Listen for HTTP requests on a client and handle them in the cloud runtime.

The HTTP server interface listens on the selected client and handles requests in the cloud JavaScript environment, streaming request and response bodies.

Here, host is a selected RemoteHost; see host discovery to obtain one. The module overview covers permissions and shared errors.

host.http.serve(options)

Function: listens for plain HTTP/1.1 on the client and forwards requests to a cloud handler. Both body directions stream on demand. Requires http_server.enabled.

ParameterTypeRequiredDescription
optionsHttpServerOptionsYesServer configuration
options.hostnamestringNoDefaults to 127.0.0.1
options.portnumberNoDefaults to 8080; integer 0–65535, with 0 allocating a free port
options.fetch(request: Request) => Response | Promise<Response>YesHandler executed in the cloud

Return value: Promise<HttpServer>. The handler receives the original method, including TRACE / TRACK; request.signal reports client disconnection. A thrown or rejected handler produces HTTP 500.

This does not publish a task URL. For public serving, use the default-exported HTTP entry.

HttpServer

Property / methodFunction and parametersType / return value
server.addrActual listening address, read-onlyReadonly<TcpAddress>
server.finishedCompletes after listener, accepted requests, and response bodies finish; rejects on transport or cleanup failurePromise<void>
server.shutdown()No arguments; stop accepting and drain responses; safe to repeatPromise<void>

Address objects contain hostname: string and port: number, as with TCP addresses.

Do not await a server's own shutdown() inside a request being handled: it would wait for itself. shutdown() and finished report the same first transport or cleanup error.

See remote.d.ts for type declarations.

host.tcp

Connect and listen for TCP connections on a client.

lexmount:browser

Manage cloud browser sessions, navigate, interact, wait, capture screenshots, and export PDFs.

Table of Contents

host.http.serve(options)
HttpServer

Still need help?Ask on Discord