server/api not working on nuxt generate
Hi, i want to prerender all of my routes to html static page. I use nuxt generate to do that. But i have some function on server/api folder like upload/delete/get files from server (i save it locally on server) that not working if i use nuxt generate. Is that other way to handle this. Sorry for my english 🤓. Thanks for all helps
2 Replies
You cannot utilise server routes on a statically generated site beyond assisting the rendering of the site. That is, a server route/api is requested at build time and cannot be subsequently requested at runtime. You would need to run the server in a node environment or alike to grant runtime access to said routes.
Thank you 🫶