-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a unique port for serving the presentation #7
Comments
@hsablonniere We should do the same in the generator. |
What's a 4-digit number that means "I'm a presentation"? 1337 has been suggested for JHipster. Angular CLI uses 4200. |
Neat way to look at it! For no particular reason, I like these numbers:
I don't want to overthink this, so let's try to arrive at something fairly soon ;) |
BTW, it would be nice to have it in a variable on top of the gulpfile. |
Hey! I've been playing with this problem on an old side project. The solution we used in the end felt very nice : port chosen between 10000 and 19999 using the absolute path of the presentation on filesystem. This is done like this : // module
const MIN_PORT = 10000
const MAX_PORT = 19999
const PORT_SPREAD = MAX_PORT - MIN_PORT
function pathToPort() {
// you need a sha1 (or other) function
const sha1Path = sha1(process.cwd())
const bigNumber = parseInt(sha1Path, 16)
const integer = bigNumber % portSpread
return minPort + integer
}
// usage
const port = pathToPort() There's a log of params that can be changed, WDYT? Cons :
Pros :
|
I like the idea of a randomly chosen port, but I don't like ports that high. I think they are hard to read and remember. We should pick ports either from 4000 - 9999 IMHO |
Both ports 8080 and 8000 are commonly used for web and application servers. There's no reason we should have to use either of these ports by default. Let's pick a unique "Bespoke" port and make that the default. Suggestions?
The text was updated successfully, but these errors were encountered: