simple http server for HTML5/JS dev
Using a Mac or Linux
and you are developing HTML or JavaScript stuff?
Guess you have often wondered how to open a simple http server at the current location in the terminal?
Here is a one-liner that requires Python.
Execute in the Shell:
python -m SimpleHTTPServer
That will start a small http server on port 8000.
You may also specify a custom port at the end if you want.
python -m SimpleHTTPServer [port]
As often, I had a Ruby script for that as well. It was simple but this one-liner is really a killer.
PS.:
According to Stackoverflow this is not working in Python 3. Instead you should write:
python -m http.server
Have not tested this however...
Written by Andreas Böhrnsen
Related protips
2 Responses
Cool
In Python3 version you can use custom port too (see python -m http.server -h for more info).
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside