Pergunta

I want to create a meteor.js app that uses subdomain as a url parameter. It will be username, so if user types: myusername.theapp.com app will show theapp.com customized with data and/or login for user myusername.

How can I do this? Is there an easy way?

Foi útil?

Solução

Client-side its easy, you can use window.location.hostname in router or somewhere else and parse it to get your username. You can also use it as a variable in subscriptions etc. and pass it to server.

Just remember that changing hostname will require full page reload, so it wont be very user-friendly.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top