(SOLVED) Help with boilerplate express secret.env , I am stuck

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. :palm_up_hand:

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) => {
  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() })
    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/ Safari/537.36

Challenge: Use the .env File

Link to the challenge:

Welcome to the forum, I have edited the title :rofl:


Welcome to the forum!

Your problem is here

That is not what the directions told you to use.

Reread the directions more carefully for the correct string.
Once you fix that small error, then the test will pass.

1 Like

Well, I thought it is okay not to follow that part since it is a string. Thank you so much for the help jwilkins.oboe! this will serve as a lesson to me. :ok_hand:

Passed it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.