Skip to content

faceyspacey/rfr-demo-mike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universal Demonstration of Redux-First Router

redux-first-router-demo screenshot

Installation

git clone https://github.com/faceyspacey/redux-first-router-demo
cd redux-first-router-demo
yarn
yarn start

Files You Should Look At:

universal code:

client code:

server code:

Notes

I comment throughout the code various things you can try. Look out for comments starting with "TRY:" and "TASK:".

For example, there are simple values like the jwToken you can toggle to get access to the restricted admin area. That showcases a key feature: authentication filtering.

In general, this Demo is all about SSR. It shows how to use the onBeforeChange to properly authenticate user's and routes using JSON Web Tokens. And of course data-fetching via thunks is central to it all. There's even a real API.

Lastly, the server/configureStore.js file is the absolute most important file of the demo. It essentially brings your routing-aware Redux store full circle in a dead simple yet flexible manner. It works in combination with src/routesMap.js. Study those and your redux routing dreams have come true 😀

As a bonus, it comes with code-splitting thanks to react-universal-component. This setup makes splitting stupid-easy. In the future, routing-aware pre-fetching will be added to the mix, so the users never know you're only serving partial parts of your app 🚀

TO DO

  • auth0-based signup/login that replaces current fake cookie/JWToken setup (PR welcome)