Miniwebserver: Unterschied zwischen den Versionen

Aus C3D2
Zur Navigation springen Zur Suche springen
(Python webserver vereinfacht.)
KKeine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
[[Category:Ruby]] [[Category:Python]]
== Python2 ==
=Python2=
<source lang="bash">
<source lang="bash">
python -m SimpleHTTPServer 8888
python -m SimpleHTTPServer 8888
</source>
</source>
=Python3=
 
== Python3 ==
<source lang="bash">
<source lang="bash">
python3 -m http.server 8888
python3 -m http.server 8888
</source>
</source>
==guru version==
 
=== guru version ===
<source lang="bash">
<source lang="bash">
twistd -n web --path $path --port $port
twistd -n web --path $path --port $port
</source>
</source>
=Ruby=
 
==äđëqüäŧë==
== Ruby ==
 
=== äđëqüäŧë ===
<source lang="ruby">
<source lang="ruby">
#!/usr/local/bin/ruby
#!/usr/local/bin/ruby
Zeile 29: Zeile 32:
s.start
s.start
</source>
</source>
==gürü==
 
== gürü ==
<source lang="bash">
<source lang="bash">
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080,:DocumentRoot=>"/tmp").start'
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080,:DocumentRoot=>"/tmp").start'
</source>
</source>


{{Rübÿ Spëëd Mëtäl Cödïng}}


 
[[Category:Python]]
{{Rübÿ Spëëd Mëtäl Cödïng}}
[[Category:Ruby]]

Version vom 19. November 2013, 01:40 Uhr

Python2

python -m SimpleHTTPServer 8888

Python3

python3 -m http.server 8888

guru version

twistd -n web --path $path --port $port

Ruby

äđëqüäŧë

#!/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

gürü

ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080,:DocumentRoot=>"/tmp").start'
Rübÿ Spëëd Mëtäl Cödïng
Coders: Astro | Conny | Sven