【发布时间】:2018-03-31 09:41:00
【问题描述】:
我有一些休息端点,像这样:
router.get('/groups/leave/:hash', (req, res) => {
if (!req.params.hash) {
return res.send({ res: false, code: responseCode.PARAMS_MISS })
}
console.log(req.params.hash)
})
用户可以去localhost:8080/groups/leave/somecode,当使用去localhost:8080/groups/leave/他得到404 - 页面不存在。
所以我的问题是,有必要(出于安全原因 - 哈希可以未定义)检查是否未定义?
【问题讨论】:
标签: node.js rest security express