diff --git a/index.js b/index.js
index e972bc238137be2100f73463869afb3f73ae753d..4082ef3df9410a4c99a8c67d5f4534d146fb1da5 100644
--- a/index.js
+++ b/index.js
@@ -12,7 +12,7 @@ app.use(bodyParser.json());
 app.use(bodyParser.urlencoded({ extended: true }));
 
 //use port is set in the environment variable, or 9001 if it isn’t set.
-app.set( 'port', ( config.port || 9001 ) );
+app.set( 'port', ( process.env.PORT || config.port ) );
 
 //for testing that the app is running
 app.get('/', function(req, res){