Tell us what’s happening:
I’ve been trying to figure out what is wrong with this for about 3 days and I am going crazy now. I have read many topics here and tried to change all the possible mistakes that I think I did but their code construction is just the same as mine, so I know I did it correctly.
Always got rejected whenever I submit my code. Is this something like a bug or error from freecodecamp side? I don’t know what to do now. Please help.
Your project link(s)
solution: boilerplate-express - Replit
Here is my code:
let express = require('express');
let app = express();
absolutePath = __dirname + "/views/index.html"
app.get("/", (req,res) => {
res.sendFile(absolutePath)
app.use("/public", express.static(__dirname + "/public"))
})
app.get("/json",(req,res) => {
let response = "hello json"
if(process.env.MESSAGE_STYLE == 'uppercase'){
res.json({ message:response.toUpperCase() })
}
else{
res.json({ message:response })
}
});
console.log("CONTENTS OF ENV: "+process.env.MESSAGE_STYLE)
module.exports = app;
My Secrets/.env:
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Challenge: Use the .env File
Link to the challenge: