How to set up local subdomains for Node.js app

前端 未结 4 396
北海茫月
北海茫月 2021-02-02 15:41

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\'

4条回答
  •  感情败类
    2021-02-02 16:31

    I'm the author of the module :)

    For each new subdomain you wish to test locally you must add into your /etc/hosts file. So for example:

    localhost is:

    127.0.0.1       localhost
    

    a new subdomain would be..

    127.0.0.1       sub1.localhost
    

    and another..

    127.0.0.1       sub2.localhost
    

    Check out what I have done in the tests.

提交回复
热议问题