iron router - subdomain support in meteor (like with slack - http://team.slack.com) -


subdomain support in meteor (like slack - http://team.slack.com)

as in slack app users can create own subdomains (unique) , depending on subdomain data should loaded, , around application proceeded. can use http://slack.com?team=teamname, think subdomain clean , better.

any suggestions/pointers.

thanks.

taken meteor forums.


using dns wildcard point *.example.com app server, have in client code:

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" ) ); }); 

make sure signed in user has permission view teamid publication records. can tweak session , "i belong team." need make sure allowed.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -