Create a .env file in the root of your project directory, and store the variable MESSAGE_STYLE=uppercase in it.
Then, in the /json GET route handler you created in the last challenge access process.env.MESSAGE_STYLE and transform the response object’s message to uppercase if the variable equals uppercase. The response object should either be {"message": "Hello json"} or {"message": "HELLO JSON"}, depending on the MESSAGE_STYLE value. Note that you must read the value of process.env.MESSAGE_STYLE inside the route handler, not outside of it, due to the way our tests run.
i am done but during testing while submit its showing :
// running tests The response of the endpoint
/json
should change according to the environment variable
MESSAGE_STYLE
// tests completed // console output [Error: Unexpected token N in JSON at position 0]
Your project link(s)
solution: boilerplate-express - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: