/** 5) serve JSON on a specific route */
app.get('/json', function (req, res ) {
res.json({"message": "Hello json"});
})
/** 6) Use the .env file to configure the app */
process.env.MESSAGE_STYLE="uppercase"
if (process.env.MESSAGE_STYLE === "uppercase") {
app.get('/json', function (req, res ) {
res.json({"message": "HELLO JSON"});
})}
I try also inner, and also
process.env.MESSAGE_STYLE="uppercase"
if (process.env.MESSAGE_STYLE === "uppercase") {
app.get('/json', function (req, res ) {
res.json(JSON.parse(JSON.stringify({"message": "HELLO JSON"})));
})}
And this is not? process.env.MESSAGE_STYLE="uppercase"
because just .env get error.
.MESSAGE_STYLE in .env is file, is not?
this also not work
res.json[“message”] =“HELLO JSON”;
I am disappointed how is it described in instructions. word “store” and the similar describing of env. file They said about process and vuala something “shell file” and you must now is not the same.
But still not woking
I also rewrite the previous, but not noNOT NNOT worked.
/** 6) Use the .env file to configure the app */
if (process.env.MESSAGE_STYLE == “uppercase”)
{console.log(process.env.MESSAGE_STYLE)
app.get(’/json’, function (req, res ) {
I now get uppercase, but the solution is not accepted.
var message ={"message": "Hello json"}
/** 5) serve JSON on a specific route */
app.get('/json', function (req, res ) {
res.json(message)
})
message.message= "HELLO JSON"
//
/** 6) Use the .env file to configure the app */
if (process.env.MESSAGE_STYLE == "uppercase")
{console.log(process.env.MESSAGE_STYLE)
console.log(message)
app.get('/json', function (req, res ) {
res.json(message)
})}
and if you look here the message is uppercase https://atom-earthworm.glitch.me/json
At first look you maybee ask how that should work?
I check that first ouput is lower case and second uppercase
I also try parse and stringify
Nobody answer two days!!! because they think is old problem and solved!!!
I also try others in curriculum they also dont work this is urgent.If nobody answer that mean none really solved.
There is a limited number of people who would even be able to help you with this. An ongoing conversation thread is more likely to solve your problem than starting over several times and it clutters the forum and makes the search functionality less useful for future users who are searching for a solution to the same problem.
believe me I try both in all variations. https://atom-earthworm.glitch.me/json I already try put instead get, without get, with if inner get. there must be a malfunction
The response of “/json” does not change according to MESSAGE_STYLE
I’ve looked at the test code in the repo. If you put https://atom-earthworm.glitch.me/json link in your submit field for the lesson, it won’t work. You have to submit it without the /json in the URL that you submit. I was able to pass by doing this.
do you have mind ** 5) serve JSON on a specific route /
/
app.get(’/json’, function (req, res ) {
res.json(message)
})
//
I try again, but no and before that one advice me to comment
** 5) serve JSON on a specific route /
/
app.get(’/json’, function (req, res ) {
res.json(message)
})