【发布时间】:2022-08-18 20:02:26
【问题描述】:
我对以下路线进行了基本的身份验证检查:
module.exports = (req, res, next) => {
if (req.session.user) {
retunr next()
} else {
console.log(\'session expired\');
res.json(\"Session Expired\");
}
}
在这里,我需要验证 URL 是否有效,例如
有效网址:http:localhost:1234/apps/applist/employee。
除了上面所有的 URL 都是无效的,比如我使用 http:localhost:1234/apps/applist 或 http:localhost:1234/apps。
我该如何解决这个问题,任何示例 sn-p?
-
这回答了你的问题了吗? Validating a URL in Node.js
标签: javascript node.js