Skip to content

Scan for route-based middleware routes/[server].middleware.ts #3880

@TheAlexLichter

Description

@TheAlexLichter

Describe the feature

Middleware can be applied globally or via object syntax at the moment. This makes route (group) based middleware hard to apply and possibly error prone, e.g. forgetting to add authorization to a single endpoint could lead to a security issue and code repetition.

Instead, having route-based middleware with the suffix pattern routes/[server].middleware.ts automatically apply to the route (and all possible child routes) would be helpful, reducing the need for code duplicates and risk of forgetting to add middleware.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions