You just need to add this snippet of code to your package.json
:
"scripts": {
"start": "node app.js"
}
You can add numerous commands that run at various times in the lifecycle of your package. For more details you can take a look at this link where it has all the specification.
By default the server expects to find a file server.js
at the root of the project, as in your case the file you need to run is the app.js
you need to specify it.
Below an example of a package.json
simple that will serve p/ you.
{
"name": "[NOME DA SUA APLICAÇÃO]",
"version": "[VERSÃO]",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "~3.4.8"
}
}
If your application is still working locally and not on your server, it is likely that the port you are reporting is not the one specified by the server. For example I use as a server the Appfog, and the port to be used by the application is informed via an environment variable process.env.VCAP_APP_PORT
.
In my application it is more or less like this:
app.set("port", process.env.VCAP_APP_PORT || 3000);
...
http.createServer(app).listen(app.get("port"));