Static GitHub Issues

[832] Does nuxtServerInit run on every request?

prev: Timeout and killed process when running `nuxt build` on node 8 / npm 5
next: no hot reload when changing scss file

I'm building an application where I want to fetch a bunch of data from different external sources, but I only want to do this once (when the server is started). I might have misunderstood how nuxtServerInit is supposed to work (or I might be doing something wrong), but I have not been able to make it run only once.

See https://glitch.com/edit/#!/excited-wish for a quick demo of the issue. (Click on 'logs' to see the console log on the server and 'show' to view the rendered page. Every time you refresh the rendered page, the server is initialized again).

Any pointers?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c714">#c714</a>)</em></sub></div>