![](/img/trans.png)
[英]Express.js: Specifying a root route breaks static file resolvement
[英]Permission route on static file express JS
當他請求具有靜態路由的頁面時,我正在嘗試對用戶進行身份驗證。
app.use(express.static(__dirname + '/public/app');
假設文件夾“模板”位於上面的路徑('/ public / app / templates')下:
app.get('/templates/permissionPage.html',function(req,res){
// if user is authorized.. reutrn the page,
else return 401..
});
我的路由甚至不輸入頁面的獲取請求。 如何處理該請求? 我希望只有特定用戶才能訪問此頁面,盡管他獲得了靜態路由。
我在前端使用angularJS
謝謝
您有兩種選擇:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.