Last active
September 1, 2020 13:26
-
-
Save reyhansofian/abce670075cbc54e268780f2b5b3fcf6 to your computer and use it in GitHub Desktop.
Using environment variable on NodeJS app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const PORT = 8080; | |
const server = http.createServer((req, res) => { | |
const MYSQL_CONNECTION = process.env.MYSQL_CONNECTION; | |
const MYSQL_USER = process.env.MYSQL_USER; | |
const MYSQL_PASSWORD = process.env.MYSQL_PASSWORD; | |
}); | |
server.listen(PORT, (err) => { | |
if (err) { | |
console.error('Something went wrong', err); | |
process.exit(1); | |
} | |
console.log(`Server is listening to port ${PORT}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment