TinyBase logoTinyBase β

onRequest

The onRequest method is called when a HTTP request is made to the party URL.

onRequest(request: Request): Promise<Response>
TypeDescription
requestRequest
returnsPromise<Response>

A Promise containing the Response to the request.

If you choose to implement additional functionality in this method, you must remember to call the super implementation to ensure the TinyBase synchronization stays supported.

import {TinyBasePartyKitServer} from 'tinybase/persisters/persister-partykit-server';

export class MyServer extends TinyBasePartyKitServer {
  async onRequest(request) {
    // custom onRequest code, else:
    return await super.onRequest(request);
  }
}

See the PartyKit server API documentation for more details.

Since

v4.3.0