Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 08a78d6db7955cf469063d0bc50a5550fa02b0df
- Author: Bernhard Reiter <ockham@raz.or.at>
- Date: Mon May 30 13:50:35 2016 +0200
- Iso-routing: Pass next() to applyMiddlewares()
- This way, it will be called in the right order even if there is an async invocation in the mw chain.
- diff --git a/server/isomorphic-routing/index.js b/server/isomorphic-routing/index.js
- index 3a35066..271c1d2 100644
- --- a/server/isomorphic-routing/index.js
- +++ b/server/isomorphic-routing/index.js
- @@ -13,16 +13,17 @@ export function serverRouter( expressApp, setUpRoute, section ) {
- combineMiddlewares(
- setSectionMiddlewareFactory( section ),
- ...middlewares
- - )
- + ),
- + serverRender
- );
- };
- }
- function combineMiddlewares( ...middlewares ) {
- - return function( req, res ) {
- + return function( req, res, next ) {
- req.context = getEnhancedContext( req );
- applyMiddlewares( req.context, ...middlewares, () => {
- - serverRender( req, res );
- + next();
- } );
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement