How to run Node.JS in OpenShift and Locally

1

How to run Node.JS in OpenShift ( link )?

openshift URL: link
GitHub: link

How to run NodeJS locally, it runs on localhost IP (127.0.0.1:port) but over live IP it does not connect, how to connect?

    
asked by anonymous 22.06.2014 / 00:01

1 answer

2

To configure your application to run on different ports in OpenShift and local, use 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);
});
    
12.11.2014 / 18:20