Usually you can use
http://localhost:3000 to visit your app, but not
http://x.localhost:3000. There are ways to configure specific domains to work this way, but that isn't enouh when you need arbitrary subdomains to all point to your same server.
This gist explains how to do it on MacOS. It was written in 2013, so here are the shortened instructions.
$ brew update $ brew install dnsmasq
Then initialize the configuration and start it up:
$ echo "address=/localhost/127.0.0.1" > /usr/local/etc/dnsmasq.conf $ brew services start dnsmasq
Not only will this start
dnsmasq, but brew will also ensure it starts when your computer restarts.
And that's it! Urls such as
http://x.y.localhost:3000 will all point to your server listening on port 3000.