Tell us what’s happening:
I have looked at numerous other examples on the forum and I don’t see why mine is not working. It displays the lowercase message, so is it something wrong with how I am trying to read the value of process.env.MESSAGE_STYLE?
https://gitpod.io#snapshot/5f1cdfe6-7517-4337-9afa-c12a3d04a386
Your code so far
require('dotenv').config();
let express = require('express');
let app = express();
console.log('Hello World');
app.get("/", function(req, res) {
res.sendFile(__dirname + '/views/index.html');
});
app.use('/public', express.static(__dirname + '/public'));
app.get('/json', function(req, res) {
if (process.env.MESSAGE_STYLE === "uppercase") {
res.json({"message": "HELLO JSON"})
} else {
res.json({"message": "Hello json"})
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Basic Node and Express - Use the .env File