/etc/hosts to manage your local domains and didn't yet hear about more effective way of managing local domains, you should definitely try the old and good dnsmasq program to improve your development workflow.
apt-get manager we will install core program.
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons.dev, .build, .systems, .shop, etc., thereat I started using shortcut .loc for a domain name I'm using on my localhost (which stands for local or localhost). Moreover the domain .loc is also not in the list of extensions for global domains.dnsmasq:[ -d /etc/resolver ] || sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/loc'sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plistsudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.backup.loc, so we add lines below to /etc/dnsmasq.conf:listen-address=127.0.0.1
address=/loc/127.0.0.1sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plistmDNSResponser service.sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist$ ping example.loc
PING example.loc (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.010 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.038 ms