Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
Is there a difference between env / ENV and PORT / port in NodeJs?

I'm new to Node.js and recently saw the following code used for the port connection :

process.ENV.PORT

And have also seen someone use process.env.PORT and even process.env.port. Now as far as I know JS variables and properties are case sensitives, so how come people are using different versions?

My IDE seems to recommend everything in lower case, so I'm curious, what I wish to know is :

  • whether all of the above are valid.

  • Why are they valid (JS is case sensitive)

  • and is there a difference between any of them

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Having process.env.PORT or process.env.port is up to you. You chose to call whatever you want your variable. And it is process.env in lowercase in Node's official doc. Here is the link if you wanna read it.

about 4 years ago · Juan Pablo Isaza Report

0

Answering your questions:

whether all of the above are valid. no, they are not. process.ENV is not the same as process.env. In fact the built-in process does not have an ENV property; so it is not valid unless you create a process.ENV property (wichi is a very bad idea btw) But in windows process.env.PORT and process.env.port they are interchangeably valid

Why are they valid ? because eventhough JS is case sensitive, the standard process.env property is, under windows, for cross-platform compatibility.

is there a difference between any of them ? .env and .ENV are different totally different .ENV does not even exist; on windows between .port and .PORT there is not any practical difference.

about 4 years ago · Juan Pablo Isaza Report

0

process.env is an object created by Node.js environment which contains some accessible internal keys and can be extended / edited programmatically. It means you can define or edit any properties you want.
So...

whether all of the above are valid
Both of them are valid because any key is valid (even process.env.notReal), which one to use is only your choice.

Why are they valid (JS is case sensitive)
Sure, JS is case sensitive, so process.env.PORT is not the same as process.env.port - they are two different properties. Variable naming policy is up to you.

and is there a difference between any of them
I guess you already got the answer, it's just a code style.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!