I couldn’t find instructions for deploying non-express Node apps.

This will help you deploy a node app to Heroku without a framework.

1. Create Heroku App

heroku create

2. Add Procfile

Procfile
1
web: node scripts/web-server.js

Tell Heroku how to start your server.

3. Add package.json

package.json
1
2
3
4
5
6
7
8
9
10
{
  "name": "build-a-twitter-game",
  "version": "0.0.1",
  "dependencies": {
  },
  "engines": {
    "node": "0.8.0",
    "npm": "1.1.1"
  }
}

List your dependencies

4. Use Heroku PORT

web-server.js
1
2
3
...
var DEFAULT_PORT = process.env.PORT || 8000;
...

Give port preference to Heroku wth the process.env.PORT environment variable

Notes

  • Make sure that you commit your changes before pushing.

  • You may need to run heroku restart after deploying.

Comments