Tell us what’s happening:
My code is below. I think I did it right but I am not sure why it is not working and am confused on if i should see Hello Json on the screen or in the terminal?
var express = require(‘express’);
var app = express();
console.log(“Hello World”);
app.get("/", function(req, res) {
res.sendFile(__dirname + “/views/index.html”);
});
app.use(express.static(__dirname + “/public”));
var responce = “HELLO JSON”.toUpperCase();
if (process.env.VAR_NAME === “allCaps”) {
response = “Hello Json”.toUpperCase();
} else {
response = “Hello Json”;
}
app.get("/json", (req, res) => {
res.json({
message: responce
});
});
Your code so far
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.104 Safari/537.36
.
Challenge: Use the .env File
Link to the challenge: