Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

POC for dynamic routing #1033

Merged
merged 12 commits into from
Aug 22, 2022
Merged

POC for dynamic routing #1033

merged 12 commits into from
Aug 22, 2022

Conversation

TheAndrewJackson
Copy link
Contributor

@TheAndrewJackson TheAndrewJackson commented Aug 3, 2022

Purpose

This PR implements a routing behavior that makes it possible for the webserver to serve dynamic urls for the frontend. It works by scanning the build directory and building out all of the routes dynamically based on all of the html files and directories within it. This works by taking advantage of the fact that the frontend routes have a 1:1 match with the files and directories in the build folder.

Changes

  • Update webserver to build out dynamic routes.

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #1101

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

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

nice solution!! I left some comments, but overall wasn't sure how thorough you wanted me to be on this review or if this is still an early stage thing. seems promising, though!

out of curiosity, did you ever try the solutions suggested in ethyca/fides#942? I haven't tried them, but it'd be cool if there's a solution on the nextjs side of things (I'm of the opinion that this is a nextjs problem, since regular ol' servers can't handle this either)

src/fidesops/main.py Show resolved Hide resolved
src/fidesops/main.py Outdated Show resolved Hide resolved
src/fidesops/main.py Show resolved Hide resolved
@TheAndrewJackson
Copy link
Contributor Author

@allisonking Thanks for the feedback! I took a look at exportPathMap and it seems like it won't work. It looks like it's used to override the automatic routes that are made based on the filesystem.

The documentation says

exportPathMap allows you to specify a mapping of request paths to page destinations, to be used during export.

and

For more advanced scenarios, you can define a parameter called exportPathMap in your next.config.js file to configure exactly which pages will be generated

From my understanding it seems like we would end up with the same static build but the routes and files that are generated would be based on the exportPathMap config instead of the file system.

@TheAndrewJackson TheAndrewJackson marked this pull request as ready for review August 18, 2022 19:01
@chriscalhoun1974 chriscalhoun1974 merged commit 58b6c51 into main Aug 22, 2022
@chriscalhoun1974 chriscalhoun1974 deleted the dynamic_routing_poc branch August 22, 2022 15:48
sanders41 pushed a commit that referenced this pull request Sep 22, 2022
* Add initial POC for dynamic routing

* fix a couple lints

* Fix mypy lint

* making pylint happy

* Remove log

* Fix another pylint issue

* Add docstring

* Update index if check

* Handle nested nextjs routes

* Update changelog
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update backend to handle dynamic frontend routes
3 participants