Challenge: Basic Node and Express - Use the .env File
Hi sorry to ask. I am struggling here. Even examples I have seen make no sense of this. It will not be capitalised but I have lost the thread of why MESSAGE_STYLES appears tagged on the back of process.env Link to the challenge:
āprocess.env.MESSAGE_STYLEā is a dot notation to refer to the enviroment variable āMESSAGE_STYLEā which is a property of the object āprocess.envā.
āprocess.envā holds all the values of environment variables as properties of the object, thus you need to refer to the variable with the dot notation āprocess.env.MESSAGE_STYLEā.
This reference to the variable is only for reading the value āuppercaseā in your script.
If you want to declare the variable and store the value āuppercaseā, do as follows:
if you are using replit you need to use secret tabs to store this variable.
If running project locally, store it in a ā.envā file.
Donāt store the variable by declaring let message=āuppercaseā, it doesnāt work for environment variables.
you can view the link provided by the hints here for the answer.
i am not able to find the problem can you help me here is my code :
const express = require(āexpressā);
const app = express();
const path = require(āpathā);
const mySecret = process.env.MESSAGE_STYLE;