Coder Social home page Coder Social logo

marufsiddiqui / redux-first-router-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from faceyspacey/redux-first-router-demo

0.0 2.0 0.0 2.15 MB

Kick-Ass Universal RFR Demo That Answers Your SSR + Splitting Questions

License: MIT License

JavaScript 77.39% CSS 22.61%

redux-first-router-demo's Introduction

Edit Redux-First Router Demo

Universal Demonstration of Redux-First Router

This demo specializes in SSR and the sort of things like redirecting and authentication you will do on the server. For the simpler example that's easier to start with, check out the Redux-First Router Boilerplate.

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 by bringing it server-side 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)

redux-first-router-demo's People

Contributors

cahva avatar corydeppen avatar davongit avatar ericclemmons avatar faceyspacey avatar garrisond avatar giamir avatar martiuh avatar maushundb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.