how to use dotenv in javascript
$ npm install dotenv
//--------------------
on file .env
//--------------------
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
DB_NAME=banco_de_dados
DB_PORT=3306
//--------------------
import the config from .env file
//--------------------
require('dotenv').config()
module.exports = {
username:process.env.DB_USER,
password:process.env.DB_PASS,
database:process.env.DB_NAME,
host:process.env.DB_HOST,
dialect:"mysql"
}
npm install dotenvdotenv file use
Also in JavaScript:
- getpermutation js recursion
- nodejs bodyparser form data
- node js to check 32 bit
- javascript sessionStorage
- react player disable download
- javascript regex Zero or one occurrence
- how to insert a value into an array javascript
- javascript float to int
- ejs include dynamic partial
- javascript send post data with ajax
- react lifecycle hooks
- js import and export
- change color by java scribt
- js remove form object by key
- appinsights trackException javascript
- check if a key exists in an object javascript
- getcollectionnames
- how to use componentdidmount in functional component
- drupal tag filter ajax content
- js select element by css selector
- moment check valid date
- page reload timeout
- node js catch any errors
- js module.exports documentation comments