Jarno
Rebuild routes.json and router.js (in the background) on target: server
Hello,
I have tried multiple solutions online but none gave the right answer for our project.
We have a Storefront built with Nuxt2 and would like to have a server endpoint in our Front-end which we can call from our Back-end.
And then quietly rebuild Nuxt2 (or only the router) so we can use the new routes that were generated.
I have tried:
build.watch
for a routes.json file we create on the server by calling the server endpoint, this only worked when running as npm run dev
and not in production with npm run start
I tried programatically with build(new Nuxt('start')
inside the server-middleware. This resulted in downtime for the entire site.
Neither of above really works for us.
Would like to see if someone else has had this problem and how they solved it!15 replies