4 ms·
Works fine for some tests, but it's single threaded. If you need concurrency: twistd -no web --path=.
by hcarvalhoalves 13y ago
Works fine for some tests, but it's single threaded. If you need concurrency:
twistd -no web --path=.
- stock_toaster 13y agoor 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)))) }
- deathanatos 13y agoPerhaps, 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…
- hcarvalhoalves 13y agoTwisted is pre-installed on OS X and various Linux distributions...