Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
meteor中的子域支持(如slack-http://team.slack.com)_Meteor_Iron Router - Fatal编程技术网

meteor中的子域支持(如slack-http://team.slack.com)

meteor中的子域支持(如slack-http://team.slack.com),meteor,iron-router,Meteor,Iron Router,meteor中的子域支持(如slack-) 在slack my app中,用户可以创建自己的子域(唯一),并根据子域加载数据,应用程序将围绕该子域继续运行。我可以使用类似的东西,但我认为子域会更干净更好 任何建议/指针 谢谢。摘自 使用DNS通配符将*.example.com指向我的应用程序服务器,客户端代码中包含以下内容: var hostnameArray = document.location.hostname.split( "." ); if ( hostnameArray[1] =

meteor中的子域支持(如slack-)

在slack my app中,用户可以创建自己的子域(唯一),并根据子域加载数据,应用程序将围绕该子域继续运行。我可以使用类似的东西,但我认为子域会更干净更好

任何建议/指针

谢谢。

摘自


使用DNS通配符将*.example.com指向我的应用程序服务器,客户端代码中包含以下内容:

var hostnameArray = document.location.hostname.split( "." );

if ( hostnameArray[1] === "example" && hostnameArray[2] === "com" ) {
  var subdomain = hostnameArray[0];  
}

if ( subdomain ) {
  Meteor.call( "findTeamBySubdomain", subdomain, function (err, res) {
    var teamId = res;
    if ( teamId )
      Session.set( "teamId", teamId ); 
    }
  });
}

Tracker.autorun ( function () {
  Meteor.subscribe( "teamInfo", Session.get( "teamId" ) );
});


确保当前登录的用户具有查看
teamId
发布记录的权限。任何人都可以调整他们的会话并说“我属于这个团队”。你需要确保他们实际上是被允许的。

有任何想法/建议我如何创建这些子域?如果你找到了解决方案,那么你可以与我共享完整的代码吗。请