N
Nuxt4mo ago
Shane

Trying to render page from post request

It seems like there is no Nuxt3 equivalent for nuxt.render https://github.com/nuxt/nuxt/issues/26378 Is there a way I can send a post request with a body to the nuxt server and receive an html response (not a redirect)?
GitHub
Is there a Nuxt3 equivalent for nuxt2's nuxt.renderRoute()? · Issue...
Describe the feature We developed an SSG that generates a static website for content from an HCMS using nuxt2 that is currently being migrated to Nuxt3. For a preview feature in the HCMS, we used t...
5 Replies
joe_black_unlucky
Can you explain your use case? So you want to handle a post and return html?
Shane
ShaneOP4mo ago
My use case is for printing documents from a server I want to be able to send JSON to the server and do SSR with it, rather than fetching JSON on the server during SSR The page will never be loaded in a web browser, just called as an API
joe_black_unlucky
Ok, gotcha, SSR will only work with get requests, I think that is built in deep in the nuxt server. If your json is not too big you could try and url encode it into a query parameter And then use a get request
Shane
ShaneOP4mo ago
Unfortunately that isn't an option because the JSON can be big For future reference, the solution is to send a post request with a file, and then send a get request to a url that references that file name jankier than what I would have liked, but it seems to work
joe_black_unlucky
Hey thanks for sharing your solution Shane. If it works who cares 🙂
Want results from more Discord servers?
Add your server