Simple Local HTTP Server With Ruby, python, nodejs

https://media.giphy.com/media/mCRJDo24UvJMA/giphy.gif

Yes, a simple HTTP server can do with Python, nodejs. And you can do it with Ruby too. Most program language offer a local HTTP server. Let’s say Sometimes you want to share document in your local network, or developing a static web page. This is simple way to run a local web service without installing software, such as with node, python or ruby.

NODE

  • Install node, npm and browser-sync

npm install -g browser-sync

browser-sync start --directory --files --server
../../../_images/browesync.png

PYTHON

python3 -m http.server 9999

or

python2 -m SimpleHTTPServer 9999

Serving HTTP on 0.0.0.0 port 9999 (http://0.0.0.0:9999/) ...

RUBY

ruby -run -e httpd . -p 9999

INFO  WEBrick 1.4.2
INFO  ruby 2.6.5 (2019-10-01) [x86_64-linux]
INFO  WEBrick::HTTPServer#start: pid=197896 port=9999