Hacker-news (front page) Clone using React /SSR
This project was bootstrapped with Create React App.
- Editor
- VS Code
- Development
- ReactJS
- Redux
- thunk
- axios
- react-icons
- sass
- lodash
- momentJS
- react-charts
- Testing
- Jest
- Enzyme
- Deployment
- Travis CI
- Heroku
CI-CD Pipeline : Travis CI
When FetchNews()
API is invoked, the following steps are followed:
- fetch Data from External API
- data is normalized before processing
- fetch local upvote data
- fetch locla hiddn items
The Data from all three steps is merged and then updated in store.
When upvote()
is invoked, the localServiceAPI is updated with new vote count and the associated dispatch
updates the store. And hence Chart+Grid.
When hideItem()
is invoked, the localServiceAPI is updated with new list of Hidden Items and the associated dispatch
updates the store. And hence Chart+Grid.
- When a certain URL is requested, the requested is directed by
express server
toRouter
which selects the matchingComponent
for that route. - The
serverRenderer
fetches the Data from external API as per the query params of theURL
. This data is Stored in Server-Store ( and also set as Initial State for Client-Redux Store) - Componet is bound to this data via Redux-
connect
and thisserver rendered component
is returned to Browser. - The App [
client
] looks to the redux store so see if async
is required?- Sync : is the process in which the external data is filtered/ modified as per data stored in
Local Service
.
- Sync : is the process in which the external data is filtered/ modified as per data stored in
- Once SYnc is done,new data is savd into
client redux store
and the same is used by Grid and Chart. - On
Prev
orNext
click, API call is triggered fromClient
to refetch the desired result, than requestingserver rendered page
again from Express Server. - On
UpVote
andHide
, the Changes are saved with the help oflocal Service API/ localstorage Service
and the same will be available during futureSYNC
process.