Re:Nweb: a tiny, safe web server (static pages only)
by dylz on Monday March 31, 2014 @10:52PM
(#7505884)
[ Parent
| on HN ]
Re:Nweb: a tiny, safe web server (static pages only)
by eik3_de on Tuesday April 01, 2014 @02:37AM
(#7506507)
the minimal Ruby equivalent would be
ruby -run -ehttpd .
Here's a handy snippet for bashrc: function S {
ruby -run -ehttpd . -p${1-8080} # default to port 8080 unless given as parameter
}
Re:Nweb: a tiny, safe web server (static pages only)
by pekk on Monday March 31, 2014 @11:35PM
(#7506027)
although that server is very horrible
Re:Nweb: a tiny, safe web server (static pages only)
by hcarvalhoalves on Monday March 31, 2014 @11:39PM
(#7506038)
Works fine for some tests, but it's single threaded. If you need concurrency:
twistd -no web --path=.
Re:Nweb: a tiny, safe web server (static pages only)
by deathanatos on Tuesday April 01, 2014 @03:07AM
(#7506593)
Perhaps, but the use case it usually finds is "I need a webserver, here. Now."
Python is nearly always installed, and that depends on nothing but the standard library. You can stick an alias in your dotfiles (I have, it's called "serve-this") and not have to worry about having twisted¹ getting to wherever your dotfiles get put. (I distribute my dotfiles over git/github, so it's really easy to move them around. More work to get Twisted.)
¹Or Ruby… or Go…
Re:Nweb: a tiny, safe web server (static pages only)
by hcarvalhoalves on Tuesday April 01, 2014 @10:08AM
(#7508247)
Twisted is pre-installed on OS X and various Linux distributions...
Re:Nweb: a tiny, safe web server (static pages only)
by stock_toaster on Tuesday April 01, 2014 @12:13AM
(#7506148)
or in go:
package main
import (
"flag"
"net/http"
)
var serveDir = flag.String("d", ".", "Directory to serve from")
func main() {
flag.Parse()
panic(http.ListenAndServe("127.0.0.1:8000", http.FileServer(
http.Dir(*serveDir))))
}
Re:Nweb: a tiny, safe web server (static pages only)
by Orangeair on Tuesday April 01, 2014 @02:44AM
(#7506526)
What's wrong with it? Honestly, I don't know. I know Python probably isn't a great choice for performance reasons, but anything else? It's super easy to build off and configure. Seems fine for a beginner (which I admittedly am; hence my asking).
Re:Nweb: a tiny, safe web server (static pages only)
by masklinn on Tuesday April 01, 2014 @03:52AM
(#7506716)
Main issue is it's single threaded. So if you use it to share big files with an other machines, only 1 file can be downloaded at a time and a download will block browsing of available files.
Re:Nweb: a tiny, safe web server (static pages only)
by lucian1900 on Tuesday April 01, 2014 @05:11AM
(#7506973)
It's also very buggy. Its only excuse is being old.