This file contains 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
app.use(async function (req, res, next) { | |
try { | |
const memoryHistory = createMemoryHistory(req.url); | |
const store = configureStore(memoryHistory); | |
const history = syncHistoryWithStore(memoryHistory, store); | |
const html = await new Promise((resolve, reject) => { | |
// match the routes to the url | |
match({history, routes, location: req.url }, (err, redirect, renderProps) => { |
This file contains 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
// express method | |
app.use(async function (req, res, next) { | |
try { | |
let flux = new Flux(); | |
var {HandlerComponent, state} = await AuxService.runReactRouter(reactRoutes, req.url); | |
await AuxService.performRouteHandlerStaticMethod(state.routes, 'routerWillRun', {state, flux, req}); | |
... | |
} |