24 lines
791 B
JavaScript
24 lines
791 B
JavaScript
// Overall summary of architecture:
|
|
// 1. A client sends an action to the server
|
|
// 2. The server hands the action to the Redux store
|
|
// 3. The store calls the reducer and the reducer executes the logic related to
|
|
// the action
|
|
// 4. The store updates its state based on the return value of the reducer
|
|
// 5. The store executes its listener function subscribed by the server
|
|
// 6. The server emits a 'state' event
|
|
// 7. All connected clients -- including the on that initiated teh original
|
|
// action -- receive the new state
|
|
import makeStore from './src/store';
|
|
import startServer from './src/server';
|
|
|
|
export const store = makeStore();
|
|
startServer(store);
|
|
|
|
// Preload the state
|
|
store.dispatch({
|
|
type: 'SET_ENTRIES',
|
|
entries: require('./entries.json')
|
|
});
|
|
store.dispatch({type: 'NEXT'});
|
|
|