<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?event=init&amp;tid=2612994575055&amp;pd[em]=<hashed_email_address>&amp;noscript=1">
Skip to content
    AdminOct 2, 2023 4:23:53 PM< 1 min read

    Nodejs create env file

    Nodejs create env file

    install npm package dotenv

    Create .env file in the root folder of project, create some variables.

    MY_VAR1="value1"
    MY_VAR2="value2"

    Use variables

    require('dotenv').config();
    
    console.log(process.env.MY_VAR1);

    click for more Nodejs codes

    COMMENTS

    RELATED ARTICLES