如何限制文件夹,只有登录我的 Meteor 应用程序的人才能下载文件?
我研究了多种方法,但主要问题是我无法访问(我得到null。):
Meteor.user() or this.userId()
我试过了:
__meteor_bootstrap__.app
    .use(connect.query())
    .use(function(req, res, next) {
        Fiber(function () {  
          // USER HERE?
        }).run();
    });
或者
__meteor_bootstrap__.app.stack.unshift({
    route: "/protected/secret_document.doc", // only users can download this
    handle: function(req, res) { Fiber(function() {
        // CHECK USER HERE ?
        // IF NOT LOGGED IN:
        res.writeHead(403, {'Content-Type': 'text/html'});
        var content = '<html><body>403 Forbidden</body></html>';
        res.end(content, 'utf-8');
    }).run() }
});