How to Respond to a POST Request by Rendering Page Route with Access to the Request Payload

I'm working on an unusual use case in next js where I need to respond to a POST request by rendering a Next.js page. Specifically, I want to receive a POST request at /api/cars that includes car data in the payload. After receiving this request, I need to render the /cars page using the payload data and respond with the resulting HTML. How can I pass the payload data to the page route for server-side rendering and return the rendered HTML in the response to the POST request?
2 Replies
Neto
Neto7d ago
in theory only, but its sound 1. take the request 2. render the component using renderToString 3. return the html back 4. render directly or use an iframe?
Want results from more Discord servers?
Add your server