Basic Node and Express - Use the .env File

Tell us what’s happening:
I have no idea how to fix this. I am working on Replit and the problems are

  1. On /json page, it shows “message”: “Hello json”
  2. There is an alert showing in Replit says “1 secret out of sync”

Here is my Secrets setting on Replit.

Thank you in advance.
Your code so far

let express = require('express');
let app = express();

app.get("/",function(req, res){
  res.sendFile(__dirname + "/views/index.html");

app.use("/public", express.static(__dirname + "/public"));
console.log("Hello World");

  const mySecret = process.env['MESSAGE_STYLE'];
  if (mySecret === "uppercase"){
    res.json({"message": "HELLO JSON"});
     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/ Safari/537.36 Edg/117.0.2045.60

Challenge: Basic Node and Express - Use the .env File

Link to the challenge:

Hi there and welcome to our community!

Could you share a direct link to your repl code please?

Is it this link?

That link works but if you just want to share your code rather than inviting me to join your repl it’s the url in the address bar when you’re viewing your code:

Anyhow, I ran your repl and submitted the live link to FCC and it passed.
You should always be submitting the link to the live project to FCC:

(This is the address which can be found directly above the Webview window).

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