Open chstappert opened 1 year ago
Hi @chstappert thanks for reaching out.
So Vue composables are meant to work under a setup context, which means, inside components. Since server routes in Nuxt work with Nitro, I'm afraid composables won't work here.
An option would be to create a server utility
for Nitro.
I'd second that!
If you're trying to satisfy the requirement from nuxt's simple-sitemap to provide a list of dynamic urls - obviously based on what we have in storyblok, this little addition would be superb.
Otherwise we're doing the whole initialization again, potentially duplicating our config
I'm currently having to setup a separate instance of storyblok-js-client
to make calls to the content delivery API from my server/api routes 😕 would be really nice to just use the Nuxt library exclusively
Description
Can we import storyblok/nuxt directly on a nuxt API route instead of using the client? The setup is already done in the nuxt.config. Since the functions are only in the composable context, it would be nice to use them now on the API routes to get data and combine them with some logic.
Suggested solution or improvement
Additional context
I want to get data from storyblok, cache them with Nitro, and use the CMS data for our own (independent) endpoint to have consistent data and a clean setup.
Validations