Run localhost webserver
This shortcut makes it easy to run a local webserver from any folder. Only available for macos.
• • •
If you need to run a local web server macOS comes with Python already available. In order to get this working, open up terminal and navigate into some folder and run the command below.
python3 -m http.server ... Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
I sometimes create static JSON files that I need to serve to an application I’m building locally. I find this solution is simple and effective one.
On macOS, you might be required to install xcode and the command line tools in order for this to work. I would recommend downloading xcode (free) from the app store. The installation of xcode, should automatically add the command line tools.