4 ms·
I use http.server all the time, particularly as modern browsers disable a bunch of functionality if you open file URLs. Had no idea there was so much other stuf
by CJefferson 3y ago
I use http.server all the time, particularly as modern browsers disable a bunch of functionality if you open file URLs. Had no idea there was so much other stuff here!
- icar 3y agoI use miniserve (`cargo install miniserve`). You also have available `npx serve`.
- HumblyTossed 3y agoOh and the Rust brigade have arrived... Was only a matter of time.
- madfucker69 3y agoHey, stop rust-shaming
- IshKebab 3y agoHow dare people mention tools written in Rust? It may be a fantastic, well loved language that's exploding in popularity and the source of endless very high quality CLI tools... but. The absolute cheek! We must only mention Python and Bash forevermore.
- HumblyTossed 3y agoEvery time there's a discussion about language X, Rusties jump in. Stop it. One of the biggest turn offs about Rust is the community.
- IshKebab 3y agoHe literally did not mention Rust.
- HumblyTossed 3y agoImplicitly, they did.
- pinkcan 3y agowww is aliassed on my .zshrc for that reason: www='python -m http.server'
- trotro 3y agoSame here, it's also by far the most convenient way I've found to share files between devices on my network.
- seanw444 3y agoSame for me. Although I just discovered `qrcp` which has been quite handy, and I'm sure there are many tools like it.
- bradrn 3y agoWait, how does that work? As far as I can see from the documentation, it can only serve on localhost, which to my understanding is only accessible from the single device it was launched on.
- vram22 3y agoHave you checked the full docs? Maybe it takes an optional parameter to specify the server machine's IP address or host name. Then others on the network could see it. Not near a PC now.
- ptx 3y agoI think you must have misread the documentation [1], which says: "By default, the server binds itself to all interfaces." [1] https://docs.python.org/3/library/http.server.html https://docs.python.org/3/library/http.server.html
- bradrn 3y agoNot ‘misread’, just ‘missed that bit entirely’. Testing it out, this is indeed the case.
- randlet 3y agoIf you serve on localhost you can usually access from other devices by using the "servers" ip address. So if your desktop where you're running the server has ip 192.168.1.10 then you can go to http://192.168.1.10 http://192.168.1.10 in the browser of another device on the same network.
- thrdbndndn 3y agoChrome also often takes forever to load even the simple HTMLs if it's a local file. I suspect it's related to relative path resource but never figured it out.