Go back Web Development

serve static HTML with Ruby (webrick)

given you have index.html in folder you can run

 ruby -run -ehttpd -- --port 3000


in zshell you can create a function/alias

# ~/.zshrc
serve_static_html () {
  ruby -run -ehttpd -- --port $1
}

$  cd ./folder
$ touch index.html
$ serve_static_html