How to run Node.JS on Openshift and Locally

Asked

Viewed 226 times

1

  • Have you seen this documentation page? https://www.openshift.com/developers/node-js

  • I’ve seen the pages of openshift and I did everything they say and it didn’t work...follows changes in the post...

  • Did you find a solution? Poste as an answer to help other people.

1 answer

2

To configure your application to run on different ports in Openshift and local, make use of the environment variables in Openshift with the configuration, as in:

var port = process.env.OPENSHIFT_NODEJS_PORT ||  process.env.OPENSHIFT_INTERNAL_PORT || 8080; 
var ipaddr = process.env.OPENSHIFT_NODEJS_IP || process.env.OPENSHIFT_INTERNAL_IP || 'localhost';

server.listen(port, ipaddr, function() {  
  console.log('%s listening at %s', server.name, server.url);
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.