hello
please help me , I am stuck in this problem and have not found a solution
var express = require(‘express’);
var app = express();
const process = require(‘process’);
app.get(’/json’,(request,response)=>{
if( process.env.MESSAGE_STYLE==“hello world”){
response.json.toUpperCase(process.env.MESSAGE_STYLE)
}
})
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36.
Challenge: Use the .env File
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
ILM
February 2, 2021, 9:17am
2
have you created the .env file and added the variable to it?
1 Like
No, i have not , here is the concept of problem:
Store the variable MESSAGE_STYLE=uppercase in the .env file. Then tell the GET /json route handler that you created in the last challenge to transform the response object’s message to uppercase if process.env.MESSAGE_STYLE equals uppercase. The response object should become {“message”: “HELLO JSON”}.
safachroudi1:
No, i have not
You need to add the file and give the value provided in the challenge text, i.e. MESSAGE_STYLE=uppercase
It is telling you to check
if process.env.MESSAGE_STYLE equals uppercase
It’s asking you to res.json() an object
The response object should become {"message": "HELLO JSON"}
I don’t think it will cause issues but you really shouldn’t have this require statement const process = require('process') in the code.
1 Like
Sky020
Split this topic
February 4, 2021, 12:53pm
5
A post was merged into an existing topic: Headers Error in .env Challenge
system
Closed
August 6, 2021, 12:54am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.