Tell us what’s happening:
Describe your issue in detail here.
As my code works fine but i was just unable to pass the test of freecodecamp.
let express = require('express');
let app = express();
const absolutePath = __dirname + "/views/index.html"
const MESSAGE_STYLE = process.env.MESSAGE_STYLE
if ( process.env.MESSAGE_STYLE === "uppercase") {
response = "Hello Json".toUpperCase();
} else {
response = "Hello Json"
}
//app.use(express.static(__dirname + "/public"))
app.use('/public', express.static(__dirname + "/public"))
app.get('/', function(req, res) {
res.sendFile(absolutePath);
})
app.get('/json', function(req, res) {
res.json({"message":response})
})
module.exports = app;
Your project link(s)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: