reactjs - Modify `/etc/hosts` file and serve per-domain pages in React -


react novice here. have situation in going creating sub-domain every client signs app , there landing page every client @ <client_name>.ourwebsite.com.

the front-end website going in react using react-router v2.8, when user visits <client_name>.ourwebsite.com, app needs pick <client_name> , query server data needed landing page.

i trying set in development environment modifying /etc/hosts file every sub-domain name.

how react app detect <client_name> , data accordingly?

i hope plain js question. can hostname using window.location.host. return xxx.ourwebsite.com result in case. use subdoamin name , send api.


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -