//当我增加了
router.get('/members/user/info/:userid',function(req,res,next){} )
如userid 为空时,跳到 主页 。 function()是进不去的。能否直接返回end() 我想这个end() 在哪地方写。
回复 (7)
M
怎么跳。 我是直接到 router.get('/',function(){});
G
写在{}里,next的不要! 自豪地采用 CNodeJS ionic
D
res.redirect('/');
M
现在这样子的,但不行。
M
引用 guosen88100300写在{}里,next的不要! 自豪地采用 CNodeJS ionic
@guosen88100300 你好。 能有例子?? 是不是这样?
router.all('/',function(){
//next() 不要这个是吗??
})
L
userid为空的话,应该是找不到匹配的路由,会跳到404那个中间件吧?
K
userid为空,应该会去找'/members/user/info/'这个router吧
参与回复
登录后即可参与回复。登录