Tell us what’s happening:
i have problem with this exercise, i’ve done setup env key = MESSAGE_STYLE, value = uppercase
and i write the code same like hint but alwas error, i can’t find where is problem.
this my code :
type or paste code here
let express = require('express');
let app = express();
require('dotenv').config()
app.use("/public", express.static(__dirname + "/public"))
app.get("/", (req, res) => {
res.sendFile(__dirname + "/views/index.html");
});
app.get("/json", (req, res) => {
res.json({
message: "Hello json"
});
});
app.get("/json", (req, res) => {
var response = "Hello World".toUpperCase();
const mySecret = process.env['MESSAGE_STYLE'];
if (process.env.VAR_NAME === "allCaps") {
response = "Hello World".toUpperCase();
} else {
response = "Hello World";
}
})
console.log("Hello World");
module.exports = app;
solution: boilerplate-express (2) - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: