Skip to content

Commit

Permalink
pipe the html in the serverless fn
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkE16 committed Jan 14, 2025
1 parent aaf370f commit cc1ea09
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ export default async function handler(req, res) {
return;
}

const { body, statusCode, headers } = httpResponse;
const { statusCode, headers } = httpResponse;
console.log("Status code: ", statusCode);
res.statusCode = statusCode;
headers.forEach(([name, value]) => res.setHeader(name, value));
res.end(body);
// res.end(body);
// We're streaming the HTML response from the server to the client.
httpResponse.pipe(res);
}

0 comments on commit cc1ea09

Please sign in to comment.