You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Plugin could not only get their prefixes from their parent directories, but also from their filename.
The nature of the feature is very similar to the existing dirNameRoutePrefix. It could take either boolean or a function checking/parsing given filename.
Motivation
It would make routes hierarchy much easier to digest and eliminate some code duplicity and hardcoded prefixes.
If I haven't missed the feature, right now, there's no easy way to declare routes prefix without either hardcoding it into the plugin file or to have a directory with an index file for each route.
Prerequisites
🚀 Feature Proposal
Plugin could not only get their prefixes from their parent directories, but also from their filename.
The nature of the feature is very similar to the existing
dirNameRoutePrefix
. It could take either boolean or a function checking/parsing given filename.Motivation
It would make routes hierarchy much easier to digest and eliminate some code duplicity and hardcoded prefixes.
If I haven't missed the feature, right now, there's no easy way to declare routes prefix without either hardcoding it into the plugin file or to have a directory with an index file for each route.
Example
Given this structure:
fastify-autoload with
fileNameRoutePrefix: true, autoHooks: true
would generate these routes and prefix the leaf plugins accordingly:The text was updated successfully, but these errors were encountered: