Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable module to work with Nitro routeRules #64

Open
1 of 3 tasks
AndersCV opened this issue Jan 16, 2024 · 1 comment
Open
1 of 3 tasks

Enable module to work with Nitro routeRules #64

AndersCV opened this issue Jan 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@AndersCV
Copy link

AndersCV commented Jan 16, 2024

Describe the feature

Would it be possible to extend functionality so that /api/__api_party/${endpointId} routes can be cached in nitro by routeRules that we can define in nuxt.config.ts?

I don't have much knowledge about the inner workings of Nuxt and Nitro so maybe this is not possible to modules but it seems like this would be a great benefit.

Currently in my project I have a bunch for endpoints delivering some SEO content that I would like to cache for an extended period of time. Currently it doesn't seem possible to use the api-party composables fetch this data and have it cached by Nitro. This means I have to manually create endpoints in my server/api folder and use a mix of useFetch for cacheable endpoints and api-party composables for non-cachable endpoints which leads to a very confusing DX.

Additional information

  • Would you be willing to help implement this feature?
  • Can you think of other implementations of this feature?

Final checks

@johannschopplich johannschopplich changed the title Enable module to work with nitro routeRules Enable module to work with Nitro routeRules Jan 16, 2024
@johannschopplich johannschopplich added enhancement New feature or request and removed pending triage labels Jan 23, 2024
@johannschopplich
Copy link
Owner

Great idea! I guess that would be possible, technically. An alternative to route rules would be a runtimeCacheStorage key, similar to the caching strategy by Nuxt OG Image.

Unfortunately, the feature exceeds my current use-cases and time for implementation is rare. Maybe I'll look into it another day. Until then: PR happily welcome. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants