Skip to content

Instantly share code, notes, and snippets.

View rubelux's full-sized avatar

rubelux rubelux

  • London
View GitHub Profile
@maximilianschmitt
maximilianschmitt / server.js
Last active November 25, 2017 15:14
Redirects on the server with react-router, express and iniquest
app.use(function(req, res, next) {
const router = Router.create({
routes,
location: req.path
});
router.run(function(Handler, state) {
router.transitionTo = function() {
const redirectUrl = router.makeHref.apply(router, arguments);
return Promise.reject({ reason: 'redirect', redirectUrl });