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

Question: Routing based on backend logic #162

Closed
mrmedicine opened this issue Jan 17, 2019 · 3 comments
Closed

Question: Routing based on backend logic #162

mrmedicine opened this issue Jan 17, 2019 · 3 comments
Labels

Comments

@mrmedicine
Copy link

Question

What would be a good / the best approach to make the following workflow possible?

  1. Universal-router, receives url '/some/page'
  2. Tries to fetch pageinfo based on '/some/page' from some backend.
  3. Either: finds the page and loads a generic react component, passes along data received from the backend to the component.
    Or: the page was not found in which case the "not found" component is returned.

Is it possible to write this logic in the resolveRoute(context, params); ?

@mrmedicine mrmedicine changed the title Routing based on backend logic Question: Routing based on backend logic Jan 17, 2019
@mrmedicine
Copy link
Author

mrmedicine commented Jan 17, 2019

I plan to add this logic to https://github.com/kriasoft/react-starter-kit for server aswell as client routing, and can place the relevant code parts here, feel free to ask questions, thanks!

@frenzzy
Copy link
Member

frenzzy commented Jan 18, 2019

hi @mrmedicine, here is an example how you can implement it: kriasoft/react-starter-kit#1237

@mrmedicine
Copy link
Author

Thanks the answer was right in front of me all along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants