Need assistance , followed the instructions, however I keep receiving the message "env File " " Failed:The response of the endpoint /json
should change according to the environment variable MESSAGE_STYLE
let express = require('express');
let app = express();
console.log("Hello World");
app.get('/', (req, res) => {
const absolutePath = __dirname + '/views/index.html';
res.sendFile(absolutePath);
});
app.use("/public", express.static(__dirname + "/public"));
app.get("/json", (req, res) => {
if ( process.env["MESSAGE_STYLE"] == "uppercase"){
res.json({"message": "HELLO JSON"})
} else {
res.json({"message": "Hello json"})
}
})
module.exports = app;
{
"MESSAGE_STYLE": "uppercase"
}
solution: https://replit.com/@javieraju/boilerplate-express-193
![package.json - boilerplate-express (1_93 (2) - Replit - Google Chrome 1_12_2023 12_11_05 AM|690x273](upload://jrCQgbXOB9hgmvfOfkwJTxPFCFo.png)
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36</code>
**Challenge:** Basic Node and Express - Use the .env File
**Link to the challenge:**
https://www.freecodecamp.org/learn/back-end-development-and-apis/basic-node-and-express/use-the--env-file
![package.json - boilerplate-express (1_93 (2) - Replit - Google Chrome 1_12_2023 12_11_05 AM|690x273](upload://jrCQgbXOB9hgmvfOfkwJTxPFCFo.png)