require(‘dotenv’).config()
let express = require(‘express’);
let app = express();
console.log(“Hello world”);
app.get(“/”, function(req, res) {res.sendFile(absolutePath = __dirname+ “/views/index.html”)})
app.use(“/public”, express.static(absolutePath = __dirname+ “/public”))
app.get(“/json”, function(req, res) {
if(process.env.MESSAGE_STYLE === "uppercase") {
res.send({"message": "hello json"});
} else {
res.send({"message": "HELLO JSON"});
}
})
this is my code but it has refused to pass
The response of the endpoint
/json
should change according to the environment variable
MESSAGE_STYLE
```this is what its saying
the response of the endpoint /json should change according to the environment variable this is wat its giving me when i use the solution link
Hi there and welcome to our community!
The issue may be that your response objects do not exactly match the requirements of the challenge:
The response object should either be {"message": "Hello json"}
or {"message": "HELLO JSON"}
, depending on the MESSAGE_STYLE
value.
(Note that the capitalisation should match exactly).
For future reference:
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.