Tell us what’s happening:
Hello, i keep getting this message
" // running tests The response of the endpoint
/json
should change according to the environment variable
MESSAGE_STYLE
// tests completed"
even though i think my code is correct (i have my .env file at the root of my project directory). Please i need assistance.
My code so far
require(‘dotenv’).config();
let express = require(‘express’);
let app = express();
app.get(“/”, (req, res) => {
res.sendFile(__dirname + ‘/views/index.html’);
});
app.use(“/public”, express.static(__dirname + ‘/public/’));
app.get(“/json”, (req, res) => {
if (process.env.MESSAGE_STYLE === “uppercase”) {
res.json({“message”: “Hello json”.toUpperCase() });
} else {
res.json({“message”: “Hello json”});
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Challenge Information:
Basic Node and Express - Use the .env File