Skip to content
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

Support multiple routes per path #126

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

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

examples/advanced-routing/README.md Show resolved Hide resolved
internal/nginx/modules/README.md Outdated Show resolved Hide resolved
internal/nginx/modules/README.md Outdated Show resolved Hide resolved
internal/nginx/modules/src/httpmatches.js Outdated Show resolved Hide resolved
internal/nginx/config/generator.go Show resolved Hide resolved
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.
Co-authored-by: Michael Pleshakov <pleshakov@users.noreply.github.com>
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 nginxinc:main Jun 23, 2022
@lucacome lucacome added the enhancement New feature or request label Aug 19, 2022
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