[英]Permission route on static file express JS
I am trying to authenticate user when he request some page that has static route. 当他请求具有静态路由的页面时,我正在尝试对用户进行身份验证。
app.use(express.static(__dirname + '/public/app');
Assume that the folder "templates" is under the path above ('/public/app/templates') : 假设文件夹“模板”位于上面的路径('/ public / app / templates')下:
app.get('/templates/permissionPage.html',function(req,res){
// if user is authorized.. reutrn the page,
else return 401..
});
my routing even don't enter the get request of the page. 我的路由甚至不输入页面的获取请求。 how can I handle that request? 如何处理该请求? I want that only specific users can access this page, although he got static route. 我希望只有特定用户才能访问此页面,尽管他获得了静态路由。
I am using angularJS on my front-end 我在前端使用angularJS
Thank you 谢谢
You have two options: 您有两种选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.