문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top