Running a Local Server

Not everyone has a development environment at their fingertips. That’s OK!

These days, it’s easy to run a local web server on your computer with some help from an interpreted language like Ruby, NodeJS or Python. Often, your computer will already have one of these languages installed.

Run the webserver

Running a local web server in any of these languages is a single command, executed from within the directory that contains your project files. First, make sure that you are in the correct directory:

$ cd to/your/project/directory

Ruby

If you like ruby like we do, just execute:

ruby -run -e httpd -- . -p 8000

NodeJS

If you like node which we also enjoy, the command is simply:

http-server . 8000

Python

When using python the command is different, based on whether you have version 2 or 3. For version 2, the command is:

python -m SimpleHTTPServer 8000

For version 3, the command is:

python -m http.server 8000

Opening a terminal

If you are unfamiliar with the terminal on your computer, don’t worry. Google will help you discover how to open a terminal on your system, whether it is:

You need to be able to open the terminal and navigate to your project directory using cd.

I hope you found this useful, please contact us if you are still blocked on loading your snippet.