Some server side data APIs are provided as serverMiddleware. These middleware can be accessed both on client side and also on server side in
asyncData when either running
nuxt start or
nuxt dev. This is a quite convenient way to access data needed for pages in
Unfortunately none of the serverMiddleware seems to be working during static generation when running
If the serverMiddleware were accessible during static file generation:
asyncDatacould have access to the initial data. There was no need for providing
I think currently the serverMiddleware are not used by design but I don't know the code enough to know why it is that way.
My current mitigation: start an API server on a different port in the
nuxt.config.js. This works but feels unnecessary.
The middleware in
serverMiddleware are accessible during static generation.