Tell us what’s happening:
Unable to get the required output. I’m not able to figure out why. I’ve tried res.send(), end(), .json(). Even if I get the correct output, it’s not being detected by the fcc test suite. Can anyone please point where I’m going wrong?
below is the project link
Your project link(s)
solution: https://replit.com/@sandeepgumaste/boilerplate-express-2
env file:
{
"MESSAGE_STYLE": "uppercase"
}
myApp.js file:
const mySecret = process.env['MESSAGE_STYLE']
console.log(mySecret)
var express = require('express');
var app = express();
app.use("/public", express.static(__dirname + "/public"));
app.get('/',(req,res)=>{
// if(mySecret==='uppercase'){
// response = "Hello json".toUpperCase();
// }else{
// response = "Hello json";
// }
// res.send({
// message: `${response}`
// })
res.send("Home page")
})
app.get("/json", (req, res) => {
if(mySecret==='uppercase'){
response = "Hello json".toUpperCase();
}else{
response = "Hello json";
}
return res.send({
message: `${response}`
})
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Use the .env File
Link to the challenge: