I feel like asking a silly question but I have googled it for a while and can't find a satisfying answer. SO doesn't such discussion either, only How to set NODE_ENV to production/development in OS X and How can I set NODE_ENV=production on Windows?
To run a command after another in one line we normally join them by ; ( or &&) 
So I had assumed I should run command like this PORT=3000 ; node server.js or export PORT=3000; node server.js , just like PORT=3000 ; echo $PORT 
But we just put a space between PORT=3000 node server.js (without ; or &&) and PORT is read into process.env.PORT. How does shell make nodejs get environment variables? It will be better if someone can show nodejs codes.
----- update ------
The reason I was puzzled with this shell syntax (according to my limited knowledge) is that I think the general format for a Unix command line is
command options(s) filename(s)
The space in between is used to separate command from option and filename. So how can it be used to separate 2 commands as well?
