#Trying to render page from post request

1 messages · Page 1 of 1 (latest)

feral needle
#

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

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...

south crest
#

Can you explain your use case? So you want to handle a post and return html?

feral needle
#

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

south crest
#

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

feral needle
#

Unfortunately that isn't an option because the JSON can be big

feral needle
#

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