yog2-kernel
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "yog2-kernel", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "yog2 kernel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,2 @@ 'use strict'; | ||
} | ||
req.__dispatcher_start_time__ = +new Date(); | ||
var routerName = null; | ||
@@ -189,2 +188,4 @@ if (req.params.router) { | ||
var rootRouterInjector = null; | ||
// lazy inject root router to prevent load router.js too early | ||
var isInjected = false; | ||
@@ -194,4 +195,8 @@ function createBaseRouter(injector) { | ||
rootRouterInjector = injector; | ||
rootRouterInjector(rootRouter); | ||
baseRouter.use(function (req, res, next) { | ||
req.__dispatcher_start_time__ = +new Date(); | ||
if (!isInjected) { | ||
rootRouterInjector(rootRouter); | ||
isInjected = true; | ||
} | ||
rootRouter(req, res, next); | ||
@@ -211,3 +216,3 @@ }); | ||
rootRouter = new express.Router(); | ||
rootRouterInjector(rootRouter); | ||
isInjected = false; | ||
}, | ||
@@ -214,0 +219,0 @@ middleware: createBaseRouter, |
33966
868