NODE_ENV is undefined even set Up was done properly

NODE_ENV is undefined even set Up was done properly

I have a&nbsp;<strong>util/config.json</strong>&nbsp;file like below:

I have a util/config.json file like below:

{
"dev": {
    "db": {
        "host": "localhost",
        "user": "root",
        "pass":"*****"

  },

"json_indentation": 4,
"database": "my-app-db-dev"

} "prod":{ "db": { "host": "somethingt", "user": "root", "pass":"****"

  },

"json_indentation": 4,
"database": "my-app-db-dev"

}

}

from a util/config.js file, I have exported it to my app.js

const config = require('./config.json')
const environment = process.env.NODE_ENV || 'dev'

const defaultConfig = config.environment; console.log(defaultConfig) // shows undefined why? module.exports = defaultConfig

app.js is like so:

const express = require('express')
const config = require('./util/config')

but it my defaultConfig shows undefined and can't fetch the data for dev (npm run dev in app.js directory) while I have set the NODE_ENV variable like this in my package.json:

"scripts": {
        "dev": "set NODE_ENV=dev && nodemon app.js",
        "prod": "set NODE_ENV=prod && nodemon app.js"
    }


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

How to Use Express.js, Node.js and MongoDB.js

In this post, I will show you how to use Express.js, Node.js and MongoDB.js. We will be creating a very simple Node application, that will allow users to input data that they want to store in a MongoDB database. It will also show all items that have been entered into the database.

Node.js for Beginners - Learn Node.js from Scratch (Step by Step)

Node.js for Beginners - Learn Node.js from Scratch (Step by Step) - Learn the basics of Node.js. This Node.js tutorial will guide you step by step so that you will learn basics and theory of every part. Learn to use Node.js like a professional. You’ll learn: Basic Of Node, Modules, NPM In Node, Event, Email, Uploading File, Advance Of Node.

Top 7 Most Popular Node.js Frameworks You Should Know

Node.js is an open-source, cross-platform, runtime environment that allows developers to run JavaScript outside of a browser. In this post, you'll see top 7 of the most popular Node frameworks at this point in time (ranked from high to low by GitHub stars).