cmdams
1
my answer was
let response = {
message : "Hello json"
}
app.get("/json", (req, res) => {
if (process.env.MESSAGE_STYLE === "uppercase") {
response.message = "Hello world".toUpperCase();
} else {
response.message = "Hello world";
}
res.json(response)
})
it always say that i have somthig wrong
snigo
2
Hey @cmdams, welcome to forum!
Something wrong like what? Can you specify the error message you see
cmdams
3
hey @snigo thanks for the reply
when i click “submit and go to the next challege” it shows this message:
// running tests
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE
// tests completed
If I’am right the answer I’ve giving is suppose to be right!
snigo
4
Maybe you meant to do “Hello json” to upper case instead?
cmdams
5
@snigo did that but still the same message appears
Cowwy
6
Perhaps you understood the question wrong.
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE
It sounds like it is saying “response of the endpoint /json” should change according to the env
Like…
if( env.MESSAGE_STYLE ) {
/* use this end point */
} else {
/* use another end point */
}
not working
app.get(’/json’, (req, res) => {
let message = “Hello json”
if(process.env.MESSAGE_STYLE==‘uppercase’){
message = message.toUpperCase()
}
res.json({“message”: message})
})