Last active
August 10, 2017 08:23
-
-
Save faceyspacey/43484273afa61e0b5685444704978762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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