How to set up local subdomains for Node.js app

前端 未结 4 406
北海茫月
北海茫月 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:20

    I had same exact problem and I found a simple solution. Instead of writing sub1.localhost try replacing localhost with lvh.me this is a domain that always resolves to localhost and now whenever you write sub1.lvh.me even though a port like sub1.lvh.me:3000 it will still work.

提交回复
热议问题