Basic Node and Express Use the .env file not working

The test for the Basic Node and Express Use the .env file is not working

var express = require('express');
var app = express();
var absolutePath = __dirname + "/views/index.html"

var assetPath = __dirname + "/public"

app.use(express.static(assetPath))

app.get("/", function(req,res){
  res.sendFile(absolutePath)
})

var response = "Hello json";
app.get("/json", function(req,res){
  if(process.env.MESSAGE_STYLE == "uppercase"){
     response = response.toUpperCase()
     console.log(response)
  }
  res.json({
    "message" : response
  })
})

and a .env file that I made:

MESSAGE_STYLE=uppercase;

Here is is on Repl.it:
https://repl.it/@PurnanshuBorkar/boilerplate-express-2#.env

What am I missing?

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36.

Challenge: Use the .env File

Link to the challenge:

there is this discussion pinned in #support :

no idea what’s going on there

1 Like