I am deploying a NodeJS application on CloudFoundry http://docs.cloudfoundry.com/frameworks/nodejs/nodejs.html.
My application is based on https://github.com/seafoox/node-express-twitter-bootstrap. Here we have two js files
1) server.js
2) app.js.
The server.js serves as a starting point for this application. When I deployed it to the CloudFoundry the application is not working. I tested it successfully by running it on the localhost using the command "node server.js". On debugging further I found that the CloudFoundry starts the application by calling "node app.js". Is it possible to configure the CloudFoundry server to start the app by calling "node server.js". Can I achieve this by using package.json.
1
votes
1 Answers
5
votes
you can specify the start script in the package.json file, like so;
{ "name":"hello-node", "version":"0.0.1", "dependencies":{ "express":"" }, "scripts": { "start": "server" } }
In this case, if I have two scripts, app.js and server.js npm will use server.js over app.js. If you actually had just server.js in the root of the application then npm would run that by default anyway.
For more information on package.json please see http://npmjs.org/doc/json.html