0

I'm developing a Ruby app that communicate with Node.JS app and I want to know if there is a way to get the port used by the Node's app in my Ruby app.

If not, can you force to run on a choosen port, without changing the code in the Node's app ?

I have found this, but it is in JS.

Cheers !

EDIT: This is possible with -p port

Community
  • 1
  • 1
Simon
  • 619
  • 2
  • 9
  • 23
  • Is your Node.js app using Express? Bare HTTP? Opening a UDP port? Let's see some code. What you're asking for is pretty straightforward, you'd just pass the port to the Node app via command line. – JP Richardson Sep 06 '12 at 15:54
  • I want to cover every case. I'm the one doing node app, I want to be able to host node app. What is the option in the command line ? Something like --port=8080 for example ? – Simon Sep 07 '12 at 13:49

1 Answers1

2

You can use environment variable to provide the port number to application. Or give it as a command line parameter.

user1186960
  • 146
  • 3
  • I don't really understand how you do this, either way … Could you explain me ? The command line seems to be relevant in my case. – Simon Sep 10 '12 at 13:12