I want to have some kind of auth to make protected routes.
(我想使用某种身份验证来创建受保护的路由。)
For example, the GET /forecastweather
should be protected.
(例如,应该保护GET /forecastweather
。)
/generalweather
should not. (而GET /generalweather
不应该。)
I read the express 4.x documentation ( https://expressjs.com/en/4x/api.html ) but I can't find an authentication function.
(我阅读了express 4.x文档( https://expressjs.com/en/4x/api.html ),但是找不到身份验证功能。)
I also looked in the req ( https://expressjs.com/en/4x/api.html#req ) documentation to see if there is an attribute to request I can use.(我还查看了req( https://expressjs.com/en/4x/api.html#req )文档,以查看是否存在可以请求使用的属性。)
If I'm right express had basic auth function, but it seems to be gone.
(如果我是对的,Express具有基本的auth功能,但是它似乎已经消失了。)
What is the best way to protect routes by some kind of bearer token.(用某种不记名令牌保护路由的最佳方法是什么。)
ask by Helper translate from so