Back-End Task Basic Node and Express - Use the .env File

Tell us what’s happening:
My test won’t pass, already searched many posts on this forum, but i can’t get my problem figured out, already added the .env file which i thought was the problem, but that’s about it, I thank everyone in advance for the support!

Your code so far
Repl.it link :
https://repl.it/@f3rn4nd0000/boilerplate-express#myApp.js

var express = require('express');
var app = express();
require('dotenv').config();

app.get("/", (req, res) => {
var path = __dirname + "/views/index.html"
res.sendFile(path)  
})

var path2 = __dirname + "/public"
app.use(express.static(path2))

app.get('/json',(req,res) => {
if (process.env.MESSAGE_STYLE === "uppercase") {  
  res.json({"message": "HELLO JSON"})
} else {
  res.json({"message": "Hello Json"});
}
})

 module.exports = app;

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0.

Challenge: Use the .env File

Link to the challenge:

Hello there,

The problem is a typo here:

res.json({"message": "Hello Json"});

Remember, in programming, every single letter and its capitalisation counts.

For future posts, please include a link to your project code, as this could be more useful.

Hope this helps

1 Like

Can’t actually believe it was just this, thanks!

Don’t want to be rude at all but what do you mean by a link to your project?
i posted the repl.it link, is there another one that i should’ve posted?

Sorry, this was my mistake. I took too quick a glance, when I first looked. :blush:

1 Like