Tell us what’s happening:
I have submitted use-the-env-file problem multiple times but still can’t pass the test, I don’t know where I am going wrong. Please help.
###Your project link(s)
solution: https://solodeving.onrender.com
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0
Challenge Information:
Basic Node and Express - Use the .env File
ILM
2
share your code please, the link you posted does not allow others to see
This is my code
let express = require('express');
let app = express();
require('dotenv').config();
console.log("Hello World");
const absolutePath = __dirname + `/views/index.html`;
// Serve static files
app.use("/public", express.static(__dirname + "/public"));
//Serve html file
app.get('/', function(req, res) {
res.sendFile(absolutePath);
})
//serve json file
app.get('/json', function(req, res) {
if (process.env.MESSAGE_STYLE === "uppercase") {
res.json({message: "Hello json".toUpperCase()});
} else {
res.json({message: "Hello json"});
}
})
module.exports = app;
ILM
6
can you also share your .env
file please