tony mathew
tony mathew

Reputation: 3

how to find process.env.PORT port number in heroku?

I need to post json data from a IOT device to the server api endpoint. But it requires the port number. How can i find a port number for process.env.PORT in heroku?

Upvotes: 0

Views: 1473

Answers (1)

Damien MATHIEU
Damien MATHIEU

Reputation: 32629

You don't need to know that port number. Within the process, Heroku requires you to bind that process. But their router will expose ports 80 and 443 and route requests properly to the process(es) running your app.

In order words: you bind to $PORT in a single process. Heroku's router binds to 80 and 443, and routes to one of many processes (or dynos).

All you have to do is make a request to your-app-name.herokuapp.com.

Upvotes: 1

Related Questions