Aman16-ai / Aman16-ai/Boggy

[H] Implement Path-to-Route Matching Algorithm

Offen
#1 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @Aman16-ai Auf GitHub ansehen
enhancement High
Vorherrschende Sprache
C++
Sterne
0
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Issue: Implement Path-to-Route Matching Algorithm

#### Description
Currently, there is no path-to-route matching algorithm implemented. We need to add a matching mechanism similar to framework-based approaches. Possible solutions include:
- Using `path-to-regex` for pattern-based matching.
- Implementing a segment-by-segment route matching strategy.

#### Examples

##### Using `path-to-regex` (Pattern-Based Matching)
- **Route Pattern:** `/users/:id/profile`
- **Incoming Path:** `/users/123/profile`
- **Matched Parameters:** `{ id: "123" }`

- **Route Pattern:** `/products/:category/:id`
- **Incoming Path:** `/products/electronics/42`
- **Matched Parameters:** `{ category: "electronics", id: "42" }`

##### Segment-by-Segment Matching
- **Route:** `/dashboard/settings`
- ✅ Matches `/dashboard/settings`
- ❌ Does **not** match `/dashboard/user/settings`

- **Route with Dynamic Segments:** `/blog/:postId/comments/:commentId`
- ✅ Matches `/blog/456/comments/789`
- ❌ Does **not** match `/blog/comments/789` (missing `postId`)

#### Task List
- [ ] Research and decide on the best approach (`path-to-regex` or segment matching).
- [ ] Implement the path-to-route matching logic.
- [ ] Add unit tests to validate different matching scenarios.

**Labels:** `enhancement` `routing`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.