Using .env to change a json package

Tell us what’s happening:
I don’t know why it’s not working, if I change the variable MESSAGE_STYLE to something different than uppercase, it passes the previous lesson, and using the console logs, supposedly it should work, maybe I am missing something?
Thanks

// running tests The response of the endpoint

/json

should change according to the environment variable

MESSAGE_STYLE

// tests completed

Your code so far
.env:

MESSAGE_STYLE=uppercase

myApp.js:


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

if( process.env.MESSAGE_STYLE === "uppercase" ) {
  response = "Hello json".toUpperCase();
} else {
  response = "Hello json";
}

app.get("/json", (req,res) => {
  res.json({ "message": response });
  console.log(response);
}); 

 module.exports = app;

Your browser information:

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

Challenge: Use the .env File

Link to the challenge:

Hello there,

This is almost identical to the issue a camper was having in this post:

Hope that helps

1 Like