Routes the incoming request to the RSC server and appropriately proxies the server response for data / resource requests, or renders to HTML for a document request.
routeRSCServerRequest({
request,
fetchServer,
createFromReadableStream,
async renderHTML(getPayload) {
const payload = await getPayload();
return await renderHTMLToReadableStream(
<RSCStaticRouter getPayload={getPayload} />,
{
bootstrapScriptContent,
formState: await getFormState(payload),
}
);
},
});
Your react-server-dom-xyz/client's createFromReadableStream function, used to decode payloads from the server.
A function that forwards a Request to the RSC handler and returns a Promise<Response> containing a serialized RSCPayload.
A function that renders the RSCPayload to HTML, usually using a <RSCStaticRouter>.
The request to route.