Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Last active August 10, 2017 08:23
Show Gist options
  • Save faceyspacey/43484273afa61e0b5685444704978762 to your computer and use it in GitHub Desktop.
Save faceyspacey/43484273afa61e0b5685444704978762 to your computer and use it in GitHub Desktop.
import createHistory from 'history/createMemoryHistory'
import configureStore from '../src/configureStore'
export default async (req, res) => {
const history = createHistory({ initialEntries: [req.path] })
const { store, thunk } = configureStore(history)
await thunk(store) // THE PAYOFF!
const status = store.getState().location.type === NOT_FOUND ? 404 : 200
res.status(status)
return store
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment