![](/img/trans.png)
[英]How to add superscript in option tag select dropdown 1st 2nd 3rd 4th 5th. 1ST I want S captial letters but i tried s will converted to small case
[英]I want to know in the 1st case the returned function is called as a middleware,,but in the 2nd case the returned function is not called
CASE1... 其中 validatebody(schemas.authschema) 返回的 function 作为中间件执行...
router.route("/signup").post(validatebody(schemas.authschema),userscontrollers.signup);
我的第二个文件导出 function 和验证器模式......
module.exports={
validatebody:function(schema)
{
return function(req,res,next)
{
var result=joi.validate(req.body,schema);
if(result.error)
return res.status(400).json(result.error);
if(!req.value)
req.value={};
req.value['body']=result.value;
next();
}
},
schemas:{
authschema:joi.object().keys(
{
email:joi.string().email().required(),
password:joi.string().required()
})
}
};
现在是第二个案例....在这种情况下,我没有 output 任何东西,并且页面持续加载很长时间,因为 function 名称第二个 ZC1C425268E68385D1AB5074C17A94F14 永远不会被触发并且...但是。 .返回的function被调用..
app.get("/users",firstfunction,secondfunction);
function firstfunction()
{
return function(req,res,next)
{
console.log(req);
next();
}
}
function secondfunction(req,res,next)
{
res.send("go there");
}
app.listen(3000);
您正在传递firstfunction
但没有调用它。 你需要做
app.get("/users",firstfunction(),secondfunction);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.