#TIL : Simple HTTP server function helper

Oct 5, 2017 4 mins read

Simple HTTP server function helper

I use python3 (3.4+) to create a bash function to help me start quickly a simple http server on specified port

function server() {
  local port="${1:-8000}" # Getting port number
  google-chrome "http://127.0.0.1:$port" # Open URL in browser, could change to firefox --new-tab "http://127.0.0.1:$port"
  python3 -m http.server $port --bind 127.0.0.1
}
comments powered by Disqus