strongloop/loopback-workspace — pull request #33 by sam-github (2014-01-01 00:43:52+00:00)
Title: Allow app to be runnable with cluster

app.js is designed to be the package.main, so app can be required. If
its run as the main module (`node app.js`), then it also starts up.
Those features are desired, but the conditionality of startup in app.js
means there is way to start the app when run under a supervisor such as
strongloop/strong-supervisor or unitech/pm2. To fix:

- Create a single line server.js which unconditionally starts
- Add a .bin property to package.json so the app can be globally
installed.
- Exports the startup code as a function(`require('app.js').main` when
app is being used as a module (so behaviour of `node server.js`
is identical to `node app.js`).
- Remove the app.js calls to strong-agent and strong-cluster-control,
they conflict with the supervisor's.