Bug Use the .env File

Tell us what’s happening:
Doesn’t work

Your code so far

var express = require('express');
var app = express();
var string = 'Hello Json',
    reponse;

app.get("/json", (req, res) => {
  if(process.env.MESSAGE_STYLE === "uppercase") {
    reponse = string.toUpperCase();
  } else {
    reponse = string;
  }

  res.json({"message": reponse});
});







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.198 Safari/537.36.

Challenge: Use the .env File

Link to the challenge:

Hello there,

Would you mind sharing a link to your project code?

Originally (in the previous lesson), you are asked to:

Serve the object {"message": "Hello json"} as a response, in JSON format, to GET requests to the /json route

Which is not quite the same as what you have.

Hope this helps

So your are trying to use an environment variable from an .env file? You are missing some codes, the way you are doing it, is like code all this

app.get("/json", (req, res) => {
  if(process.env.MESSAGE_STYLE === "uppercase") {
    reponse = string.toUpperCase();
  } else {
    reponse = string;
  }

  res.json({"message": reponse});
});

but without this

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

so to use express you need this:

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

and so to use .env file you need…


https://nodeex.hugocode1.repl.co/json

It’s work my output say HELLO JSON but fcc don’t aprouved :’(

Please provide the link to your code. Not the app.

What I meant with my previous reply, is this is not correct:

var string = 'Hello Json',