1

With Rails and puma-dev I can easily have multiple projects on my dev machine running on different hosts e.g.

~/development/myapp => http://myapp.test
~/development/myapp2 => http://myapp2.test
~/development/myapp3 => http://myapp3.test

With NodeJS (NextJS etc.) it is

~/development/myapp => http://localhost:3000
~/development/myapp2 => http://localhost:3001
~/development/myapp3 => http://localhost:3003

And I have to manually run npm run dev for each.

How do I get similar functionality to Rails and puma-dev please?

I have tried to edit /etc/hosts but am not clear on how to avoid having a port in the URL e.g. I don't want http://myapp.test:3000 nor do I want to run npm run dev on port 80 or 8080.

Paul Watson
  • 732
  • 7
  • 17
  • You might be able to use Fiddler if you're on Windows: https://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file#answer-21586034 – Bryan Aug 02 '19 at 13:54
  • @Bryan — I don't see Fiddler starting services on demand – Quentin Aug 02 '19 at 13:55
  • if you're using a linux machine, you could use nginx server to proxy your localhost. If you're using windows, I don't see how possible. if you really need to get rid of the port, you could try ngrok, which gives you a public url https://ngrok.com/ – kengres Aug 02 '19 at 14:03

0 Answers0