Skip to content

Support multiple routes per path #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 23, 2022

Conversation

kate-osborn
Copy link
Contributor

Proposed changes

Support multiple routes per path.

  • Adds new boolean field any to the internal httpMatch object. An httpMatch with any=true represents a path-only match. Any request sent to the path will satisfy this match.
  • Changes algorithm for sorting routes to match the rules defined by the spec.
  • Removes the logic for handling HTTPRoutes with nil matches. The schema for HTTPRoutes enforces a default match, so matches will never be nil.
  • Adds local development instructions for njs module as well as test coverage output.
  • Reorganizes njs modules directory to mimic a JavaScript project layout.
    • /src contains source files
    • /test contains test files
  • Updates advanced-routing example to demonstrate new capabilities.

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@kate-osborn kate-osborn force-pushed the support-multiple-matches branch from 2cc1267 to 0cffe13 Compare June 15, 2022 15:37
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kate-osborn Please see my comments and suggestions

Kate Osborn and others added 7 commits June 23, 2022 09:52
* Adds new boolean field "any" to internal httpMatch object. An httpMatch with any=true represents a path-only match.
Any request sent to the path will satisfy this match.
* Changes algorithm for sorting routes to match the rules defined by the spec.
* Adds local development instructions for njs module as well as test coverage output.
* Updates advanced-routing example to demonstrate new capabilities.
@kate-osborn kate-osborn force-pushed the support-multiple-matches branch from 9cf5cab to e9e6a20 Compare June 23, 2022 16:11
@kate-osborn kate-osborn requested a review from pleshakov June 23, 2022 16:12
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kate-osborn kate-osborn merged commit 7f18e36 into nginx:main Jun 23, 2022
@lucacome lucacome added the enhancement New feature or request label Aug 19, 2022
miledxz added a commit to miledxz/nginx-gateway-fabric that referenced this pull request Jan 14, 2025
* Support multiple routes per path

* Adds new boolean field "any" to internal httpMatch object. An httpMatch with any=true represents a path-only match. Any request sent to the path will satisfy this match.
* Changes algorithm for sorting routes to match the rules defined by the spec.
* Adds local development instructions for njs module as well as test coverage output.
* Updates advanced-routing example to demonstrate new capabilities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants