Allow `server` routes to defer back to the Nuxt renderer
manniL opened this issue · comments
Describe the feature
If you have the desire to write a server
route which should only conditionally return values (think of accept
header being set to application/json
) and otherwise let Nuxt render the route, it isn't straightforward to do so.
Having a way to "defer back to the Nuxt renderer", ideally as "default" behavior when not returning a value or when calling a specific method would be helpful
Related:
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.
cc: @pi0
This is similar to server action support. If needed, I suggest registering a passthrough router in a middleware however I would strongly advise approaching it as an opt-in module (for use-cases really need overlapping routes) rather than built-in feature because of additional to middleware complexities it adds and one route acting differently.
Maybe that's something which should be documented then as recipe + pointing out when to use / when not use it?