一直盯着我
app.get('/private/:file', function(req, res, next){ console.log('about to send restricted file '+ req.params.file); req.url = req.url.replace(/^/private/, '') staticMiddleware(req, res, next);});
编辑11-29-2014
因此,在有人提出问题之后,我回到了这个答案,以至于即使我提到了passportjs,也从未展示过我最终如何使用此功能。
var staticMiddlewarePrivate = express['static'](__dirname + '/private');app.get('/private/*/:file', auth.ensureAuthenticated, function(req, res, next){ console.log('**** Private ****'); req.url = req.url.replace(/^/private/, ''); staticMiddlewarePrivate(req, res, next);});
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)