process.env in Node.js
process | Node.js
http://nodejs.cn/api/process.html
process is a global object
http://nodejs.cn/api/process.html#process_process_env
demo in script:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./prod.js')
} else {
module.exports = require('./dev.js')
}
input "node" line commend
node
> process.env // show value
On Windows: set test=testValue
on OS X or Linux: export test=testValue
In js file
process.env.test= 'dev';
package.json:
"scripts": {
"start": "set test=dev && node app.js"
}
------------------------
Windows environment variant
cmd
> set test-env // exit
set test-env=production
set path=%path%;C:\web;C:\Tools
set test-env=
my computer -> property -> advance -> environment variant...
----------------------
Linux
echo $test-env //check value of test-env
// set value of test-env
export test-env=production
# attach value
export path=$path:/home/download:/usr/local/
#delete value of test-env
unset test-env
#show all variants
env
# for all users
vim /etc/profile
# only current user
vim ~/.bash_profile
export path=$path:/home/download:/usr/local/
export test-env= product
# edit /etc/profile , then to run the following
source /etc/profile
# edit ~/.bash_profile , then to run the following
source ~/.bash_profile
-------------------
linux
export NODE_ENV=dev
https://www.npmjs.com/package/request
const request = require('request');
reference: http://www.ssqhm.com https://www.cnblogs.com/zdz8207/p/nodejs-process-env.html
https://segmentfault.com/a/1190000011683741
Water Hack Burns 2 lb of Fat OVERNIGHT
回复删除Well over 160,000 men and women are hacking their diet with a easy and secret "liquid hack" to burn 2 lbs every night as they sleep.
It's very easy and it works on everybody.
Here's how you can do it yourself:
1) Go grab a drinking glass and fill it up with water half glass
2) And now do this weight losing hack
and you'll be 2 lbs skinnier as soon as tomorrow!