Tell us what’s happening:
Describe your issue in detail here.
let express = require('express');
let app = express();
console.log("Hello World")
/*app.get('/',(request,response)=>{
response.send("Hello Express")
})*/
app.get('/', (request, response) => {
response.sendFile(__dirname + '/views/index.html')
})
app.use("/public", express.static(__dirname + "/public"));
let message =
app.get('/json', (request, response) => {
if (process.env['MESSAGE_STYLE'] == 'uppercase') {
response.json({ "message": "HELLO JSON" })
} else {
response.json({
"message":"Hello json "
})
}
})
module.exports = app;
code is working correct but it is showing
The response of the endpoint /json
should change according to the environment variable MESSAGE_STYLE
what i should do to resove this
Your project link(s)
solution: https://boilerplate-express--pavan-singhsin1.repl.co
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: