Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node using environment variable

// server.js
console.log(`Your port is ${process.env.PORT}`); // undefined
const dotenv = require('dotenv');
dotenv.config();
console.log(`Your port is ${process.env.PORT}`); // 8626
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #node #environment #variable
ADD COMMENT
Topic
Name
8+7 =