I still remember one of the most interesting questions I have been asked last year when I was interviewing for a Software Engineering position:
How would you explain to a 12 years old what an API is?
At first, I was surprised: it certainly sounded like an uncommon question for a Software Engineering interview. And yet I tried to answer as best I could, trying to come up with a concise definition that could convey what I meant, but without assuming any specialist knowledge about computers and software.
As I progressed with the interview, it became evident what kind of ability my interviewer was trying to test.
I didn’t want to go through the hassle of setting up Apache on my Mac, though, and I was looking for some quick alternative to installing a local web server. After some Googling, I found a wonderful one liner that did the job, provided that you have Python installed.
Open a Terminal window and go to the directory containing the files you want to serve and run:
python -m SimpleHTTPServer
or, if you are using Python 3,
python -m http.server
you will then be able to access your files on http://localhost:8000/. (You can specify a different port number by passing the number as last argument, just remember that you need root permissions to open sockets on ports lower than 1024.)