Restate Typescript SDK
    Preparing search index...

    Function createEndpointHandler

    • Creates a request handler for the provided services.

      The returned handler auto-detects the HTTP protocol version per request:

      • HTTP/2+ requests use bidirectional streaming (BIDI_STREAM)
      • HTTP/1.1 requests use request-response mode (REQUEST_RESPONSE) by default

      Set bidirectional: true to force BIDI_STREAM for all requests, or bidirectional: false to force REQUEST_RESPONSE for all requests.

      Parameters

      Returns {
          (request: IncomingMessage, response: ServerResponse): void;
          (request: Http2ServerRequest, response: Http2ServerResponse): void;
      }

      A request handler function compatible with both HTTP/1.1 and HTTP/2 servers.

      const httpServer = http2.createServer(createEndpointHandler({ services: [myService] }));
      httpServer.listen(port);
      const httpServer = http.createServer(createEndpointHandler({ services: [myService] }));
      httpServer.listen(port);