I am running an express app on node.js. The app uses the express-subdomain module to help handle routes for two different subdomains (sub1.example.com and sub2.example.com). I\'
For creating subdomains for localhost you just need to follow 2 simple steps.
Open your terminal by pressing CTRL + ALT + T
then run the following commands:
sudo vi hosts
sudo -i gedit /etc/hosts # to edit /etc/hosts file
Once you run 2nd command /etc/hosts
file will open and now this is the place where you need to define subdomains.
Example: localhost
is:
127.0.0.1 //our localhost
define new subdomain:
127.0.0.1 example.localhost # first
and another..
127.0.0.1 demo.localhost #second
that's it. Hope this was helpful.