Skip to content

RFC: Include custom url matcher in filesystem routing #1386

Closed

Description

@DevWedeloper

Which scope/s are relevant/related to the feature request?

router

Information

This RFC proposes adding support for Custom URL Matchers within the existing filesystem-based routing of Analog. This feature would allow developers to define custom logic for URL pattern matching directly within .page.ts files, enabling more flexible and complex routing patterns.

Proposed Implementation:

  1. Naming Pattern for Custom Matchers:
  • Introduce a naming convention or symbol (e.g., $) in .page.ts filenames to signify that the file contains a custom URL matcher.
  • For example, a file named [$example].page.ts would indicate that this route uses a custom matcher instead of relying on standard static or dynamic routing.
  1. Matcher Defined Inside .page.ts:
  • Developers would define a custom matcher function, similar to Angular’s UrlMatcher. This function would return a UrlMatchResult if the URL matches the defined logic.

    Example:

    export const urlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route): UrlMatchResult | null => {
       ...
    };
    
    

Describe any alternatives/workarounds you're currently using

I'm using the provideRouter along with provideFileRouter

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Activity

  1. locked and limited conversation to collaborators on Nov 21, 2024
  2. converted this issue into a discussion #1452 on Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions