c3d2-wiki/Miniwebserver.mw

44 lines
760 B
Plaintext

== Python2 ==
<source lang="bash">
python -m SimpleHTTPServer 8888
</source>
== Python3 ==
<source lang="bash">
python3 -m http.server 8888
</source>
=== guru version ===
<source lang="bash">
twistd -n web --path $path --port $port
</source>
== Ruby ==
=== äđëqüäŧë ===
<source lang="ruby">
#!/usr/local/bin/ruby
require 'webrick'
include WEBrick
if ARGV.size != 2
puts "Usage: #{$0} <port> <dir>"
exit
end
s = HTTPServer.new(
:Port => ARGV[0].to_i,
:DocumentRoot => ARGV[1]
)
trap("INT"){ s.shutdown }
s.start
</source>
== gürü ==
<source lang="bash">
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080,:DocumentRoot=>"/tmp").start'
</source>
{{Rübÿ Spëëd Mëtäl Cödïng}}
[[Category:Python]]
[[Category:Ruby]]