lukejacksonn / servor

Dependency free file server for single page app development
MIT License
1.04k stars 70 forks source link

Try default port before picking a random free port #35

Closed lukejacksonn closed 4 years ago

lukejacksonn commented 4 years ago

As discussed in #34 having the server starting on a completely random port (if no port is explicitly provided) can be confusing for non power users.

This PR address the issue by changing this behaviour. The port selection behaviour is now as follows:

This behaviour aligns better with other local file server modules (which usually pick a default port to run on, albeit usually failing if they cannot do so) and so hopefully helps eliminate some potential for confusion.

FredKSchott commented 4 years ago

+1! If you end up merging/releasing this lmk and I'll make servor the default server in our docs.

Awesome work on the project btw! Impressed by how much this does without a single dep

lukejacksonn commented 4 years ago

Ok, given that there are no objections here and I have had chance to sleep on the decision (I see very few downsides) I am going merge and publish this as 3.1.0 🎉

FredKSchott commented 4 years ago

Great! Just updated the docs to use this!

$ npx servor
npx: installed 1 in 2.219s
$ npx servor
npx: installed 1 in 0.864s
$ npx servor
npx: installed 1 in 0.876s

I could run this all day :)