You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to match a pathname to dynamically generated routes based on a record ID in the database.
For that I send the ID to the API, get the record and then create the router with the dynamic paths of that record.
Is this an issue if I create the router on every request (with the ID) dynamically or would it be fine to do that because it's lightweight anyway?
If there is a better way, I'm open to suggestions. An idea was to use path-to-regexp instead but this doesn't handle sorting etc. of the routes and I need to find the best match (if any).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey!
I need to match a pathname to dynamically generated routes based on a record ID in the database.
For that I send the ID to the API, get the record and then create the router with the dynamic paths of that record.
Is this an issue if I create the router on every request (with the ID) dynamically or would it be fine to do that because it's lightweight anyway?
If there is a better way, I'm open to suggestions. An idea was to use
path-to-regexp
instead but this doesn't handle sorting etc. of the routes and I need to find the best match (if any).Beta Was this translation helpful? Give feedback.
All reactions