How do we defined port in Express JS?

In Express JS ,

we write this

var port = process.env.port || 1305;

what is process.env.port ? Where do we define it ? How it gets value ?

You could take a look at the NodeJS manual for this one, but it’s what it’s doing is returning an object containing the user environment. There’s an example in the page you can look at.

Or look at the first answer here

1 Like

got it…thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.