Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created January 13, 2014 16:59
Show Gist options
  • Select an option

  • Save jeremyckahn/8403780 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyckahn/8403780 to your computer and use it in GitHub Desktop.
Serves a directory and opens the root in the browser.
#!/bin/bash
# Open the page in 500 in milliseconds. This is done with a timer so that
# http-server can be ctrl-c'ed and the browser doesn't open to a 404-ing page.
echo "
setTimeout(function () {
require('open')('http://localhost:9000');
}, 500);
" | node
node node_modules/http-server/bin/http-server -p 9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment