The server: serveStore hosts the handler of a store on node:http through the server of commons, so that it runs on Bun and on Node. It listens on the loopback unless the program names an address with an exposure that names the hosts it may be asked for, and it starts with a random token that the program shows to the person who started it, unless the program gives its own way to know who asks.
type ServeStoreOptions = Omit<HandlerOptions, "authenticator" | "hosts"> & {
/** The port; 0 asks for a free one. */
…(648 characters)
typeServeStoreOptions=Omit<HandlerOptions, "authenticator"|"hosts"> & {
/** The port; 0 asks for a free one. */readonlyport?:number;
/** Where it may listen: the loopback by default. */readonlyexposure?:Exposure;
/** Who may ask; the token the server makes by default. */readonlyauthenticator?:Authenticator;
/** The token to use where none of the above is given; made at random where not given. */readonlytoken?:string;
/** Told the token the server made, so that the program can show it to the person who started the server (it is never logged by the server). */readonlyonToken?: (token:string) =>void;
};
What the server is told besides what the handler is.
typeServing= {
/** The address, with the port. */readonlyurl:string;
readonlyport:number;
/** The token that is accepted where the server made it, else undefined. */readonlytoken:string|undefined;
close():Promise<void>;
};