Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top