Tell us what’s happening:
This is my myApp.js file :
let express = require('express');
require('dotenv').config();
let app = express();
app.get('/json', (req,res) => {
if(process.env.MESSAGE_STYLE==='uppercase')
res.json({"message": "HELLO JSON"});
else res.json({"message": "Hello json"});
});
this is what in my dot env file given below savedd as .env:
MESSAGE_STYLE=uppercase;
It should be working but it is not . why ? by the when I console (process.env.MESSAGE_STYLE === ‘uppercase’) in the route handler it shows false. why?
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Basic Node and Express - Use the .env File