import { renderString, createRequestHandler } from '@edenx/runtime/ssr/server';
import type { HandleRequest } from '@edenx/runtime/ssr/server';
const handleRequest: HandleRequest = async (request, ServerRoot, options) => {
// do something before rendering
const body = await renderString(request, <ServerRoot />, options);
const newBody = body + '<div>Byte-Dance</div>';
return new Response(newBody, {
headers: {
'content-type': 'text/html; charset=UTF-8',
'x-custom-header': 'abc',
},
});
};
export default createRequestHandler(handleRequest);