How to start a local server and open it in a browser from a shell script

Posted by davidchambers on Super User See other posts from Super User or by davidchambers
Published on 2012-12-03T06:31:12Z Indexed on 2012/12/03 11:27 UTC
Read the original article Hit count: 133

Filed under:

I have a test suite which runs in a browser (using QUnit, though that's unimportant). The test suite requires a local server running on a particular port. Running the tests currently involves a few steps:

  1. node test/server
  2. switch to browser of choice
  3. open localhost:3000

I'd like to have a single command which starts the server then runs open localhost:3000. Ideally, the node process would remain in the foreground so it could be killed with ^C. I don't have a good understanding of subshells, so I'm not sure whether this is possible.

© Super User or respective owner

Related posts about processes