-3

After writing foo.html with some CSS and some JavaScript, I test it on Safari, Firefox, and Chrome, and see that all is well.

I'd now like to debug the files on iOS and Android.

What is the lightest weight server I can launch from the command line? I would like to run in the Terminal:

> runserver .

to be able subsequently to point browsers to, say, http://192.168.5.2/foo.html on either an Android or an iOS device on the local network, and see the file.

Calaf
  • 111
  • 5

1 Answers1

1

On OSX, Python's SimpleHTTPServer is probably your best bet.

https://docs.python.org/2/library/simplehttpserver.html

python -m SimpleHTTPServer 8000

will serve the current directory at http://localhost:8000/

ceejayoz
  • 32,910
  • 7
  • 82
  • 106
  • Perfect, yet somehow incomplete! I can look at what `netstat` says and figure out the IP to connect to from other machines/devices on the network. If you know of a command-line statement that will produce just the IP needed, please share it. – Calaf Jun 23 '16 at 19:22
  • 1
    @Calaf http://stackoverflow.com/questions/13322485/how-to-i-get-the-primary-ip-address-of-the-local-machine-on-linux-and-os-x – ceejayoz Jun 23 '16 at 19:29
  • This is great. It should be in everyone's ~/.bash_profile. I'm puzzled by the downvotes. I wish they would state their objections. Is stackoverflow a better fit than serverfault for this kind of question? – Calaf Jun 23 '16 at 19:55
  • Neither one's really a fit. Both consider your question off-topic. – ceejayoz Jun 23 '16 at 19:59
  • ... the 150+ upvotes on the answer you kindly shared notwithstanding, that is :) – Calaf Jun 23 '16 at 20:03