Michel
Michel

Reputation: 11755

Procfile on Node.js/Heroku

I am rereading this tutorial https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction to polish my understanding of Node.js/Heroku.

There is a section called Define a Procfile.

But when I go to see my own apps to check what is inside this file. I see that a number of apps (not all) have no such a file and are working fine.

So, what is going on? When is Procfile necessary? What happens if there is none? When is it better to have one?

Upvotes: 0

Views: 1328

Answers (1)

byteSlayer
byteSlayer

Reputation: 2143

To help you get started, Heroku will try to automatically detect the type of your app and start it appropriately, even when it doesn't have a Profile (see example here - http://blog.taylorrf.com/blog/2014/12/15/heroku-default-server/ ).

For example in Node, if you have an index.js file and a package.json file, it's probably a node app that could be started with node index.js.

While convenient, this is considered bad practice, because:

  1. Heroku may change how they auto detect apps in the future, breaking your deployment.
  2. You might be missing out on some configurations / optimizations by doing so (see article linked above).

Upvotes: 1

Related Questions