Tell us what’s happening:
https://boilerplate-express.dletulle.repl.co/json
Inside my Repl.it I created the file “process.env” and the only line in it is:
MESSAGE_STYLE=uppercase
I’ve tried restarting the server, but the code still wont become uppercase.
I’ve even tried copying code from others which have completed the challenge and even copied the code from the solution, but it doesn’t work.
Any idea what I’m missing here?
var express = require('express');
var app = express();
console.log("Hello World")
/*
app.get("/", (req, res) => {
res.send("Hello Express");
});
*/
app.get("/", (req, res) => {
absolutePath = __dirname + "/views/index.html";
res.sendFile(absolutePath);
})
app.get("/json", (req, res) => {
message = "Hello json";
process.env.MESSAGE_STYLE === "uppercase" ?
res.json({ "message": message.toUppercase() }):
res.json({ "message": message })
})
app.use("/public", express.static(__dirname + "/public"));
Your project link(s)
solution: https://boilerplate-express.dletulle.repl.co/json
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.190 Safari/537.36
.
Challenge: Use the .env File
Link to the challenge: