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 path prefix matching for client-side routing #220

Closed
Tracked by #209
Tzal3x opened this issue Sep 24, 2024 · 0 comments · Fixed by #233 · May be fixed by #236
Closed
Tracked by #209

Support path prefix matching for client-side routing #220

Tzal3x opened this issue Sep 24, 2024 · 0 comments · Fixed by #233 · May be fixed by #236
Assignees
Labels

Comments

@Tzal3x
Copy link
Collaborator

Tzal3x commented Sep 24, 2024

In ws-resources.json, define routes pointing to other routes for client-side routing:

{
  ...
  "routes": [
    {
      "route": "/*",
      "serve": "/index.html",
    },
    ...
  ]
  ...
}

The final goal is to specify routes like it's done in the nextjs middleware.

For starters, we can avoid complex expressions like /some/*/path and only implement patterns that end with wildcards like this: /some/path/*.

Implementation

  • Each Walrus site requires its own ws-resources.json in site resources.
  • When a walrus site is fetched for the first time, the portal should try to also parse the ws-resources.json resource.

When present, the portal prioritizes routing requests based on this configuration file before falling back to default routing mechanisms.

@Tzal3x Tzal3x mentioned this issue Sep 24, 2024
9 tasks
@Tzal3x Tzal3x changed the title Common portal lib: Support path prefix matching for client-side routing. Support path prefix matching for client-side routing. Sep 24, 2024
@Tzal3x Tzal3x self-assigned this Sep 24, 2024
@Tzal3x Tzal3x added the portal label Sep 24, 2024
@Tzal3x Tzal3x changed the title Support path prefix matching for client-side routing. Support path prefix matching for client-side routing Sep 24, 2024
@Tzal3x Tzal3x linked a pull request Oct 9, 2024 that will close this issue
2 tasks
Tzal3x added a commit that referenced this issue Oct 11, 2024
Update the portal code so that it aligns with the changes made in #220

Changelog:

- [x] Create a `routing.ts` file containing the logic of parsing the
Routes dynamic field.
- [x] Add a function that finds if a path matches a route specified in
the Routes DF.

---------

Signed-off-by: giac-mysten <[email protected]>
Co-authored-by: giac-mysten <[email protected]>
@Tzal3x Tzal3x closed this as completed Oct 11, 2024
giac-mysten added a commit that referenced this issue Oct 16, 2024
Update the portal code so that it aligns with the changes made in #220

Changelog:

- [x] Create a `routing.ts` file containing the logic of parsing the
Routes dynamic field.
- [x] Add a function that finds if a path matches a route specified in
the Routes DF.

---------

Signed-off-by: giac-mysten <[email protected]>
Co-authored-by: giac-mysten <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment