Target Server with serverMiddleware which adds content
See original GitHub issueI have an api as a nuxt serverMiddleware which creates entries to the /content folder on post requests. I expected that $content fetches all entries, also the newly created ones. In dev it works, build & start does not work: it only shows the entries which are available at build time.
Is this intended? Is there a way to make it working?
nuxt.config.js
target: 'server',
ssr: true,
pages/index.vue
async asyncData ({ $content }) {
const tests = await $content('tests').fetch()
return {
tests
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
The serverMiddleware Property - Nuxt
The serverMiddleware property ... Define server-side middleware. ... Nuxt internally creates a connect instance that you can add your own custom middleware to....
Read more >Nuxt server middleware with generate - Stack Overflow
Server middleware basically allows you to run your own code on the server nuxt spins up for you in target: 'server' mode.
Read more >Make serverMiddleware available when generating static pages
Some server side data APIs are provided as serverMiddleware. ... Downloaded the nuxt version 2.14 and set up the target property.
Read more >How to Configure SSG and SSR on Nuxt.js - Mad Devs
There, you add metadata, connect plugins, configure the server, ... Then, in nuxt.config.js file, add a new key serverMiddleware.
Read more >Nuxt.js for Busy Developers - CODE Magazine
The app content, composed of JS and CSS files, loads one time only. ... Think of a server-middleware as a Node.js middleware you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
finally solved it. digged through the source code and found that there is watch property. watch property is not named in the docs. why? is there a downside to it? will open an enhancement for this.
it works fine with custom server middleware for authentification. thanks!