Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// 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});
// app component
class App extends React.Component {
static async routerWillRun({flux, state, req}) {
await flux.getActions('session').getSession(req);
// rendering ...
// session actions
class SessionActions extends AppActions {
getSession(req) {
// using req object here to pass cookies
return this.apiGet('/api/session/get', req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment