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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -