Skip to content

createRenderHandler

createRenderHandler(options): (request) => Promise<Response>

A request handler for the render protocol, built on the standard Request and Response, so it mounts directly in a Node server, a Cloudflare Worker, or a Next.js route handler:

export const POST = createRenderHandler({ secretFor: () => process.env.RENDER_SECRET, render })

It refuses anything but a POST, reads at most 64 KB, checks the signature over the exact bytes received (with a replay window) before it believes any field, and never echoes the delivery key. Answers: 200 with the message, 400 for a malformed request, 401 for a bad signature or an unknown connection, 404 when the page is not published, 413 when the body is too large, 500 for any other failure.

RenderHandlerOptions

(request) => Promise<Response>