janpaul123 / paperprograms

Run Javascript on pieces of paper!
https://paperprograms.org
MIT License
498 stars 54 forks source link

If port 3000 is being used, find another port #52

Open jedahan opened 6 years ago

jedahan commented 6 years ago

https://www.npmjs.com/package/get-port has a neat way of doing this - you request 3000 but if that doesn't work, it grabs another one.

You can then use https://www.npmjs.com/package/opn to automatically open it

And then in the browser, grab the port from window.location

Lemme know the good/bad/ugly of this idea

janpaul123 commented 6 years ago

Localstorage (which contains the settings) is per-port. So you'd lose your settings if it'd automatically pick a different port.

Just quit whatever is running on port 3000 when developing locally? (And use the paperprograms.org hosted version when not developing)