In this challenge it is required to create a .env
file but replit.com doesn’t allow that anymore. Is there any way to fix this?
Hello there,
Do you see the note at the bottom of the challenge instructions? It explains what you need to do.
Hope this helps
Thank you, I didn’t see that. By the way, my code doesn’t work, can you help me with this
var express = require('express');
var app = express()
const mySecret = process.env['MESSAGE_STYLE']
app.get("/json",(req,res)=>{
if(process.env.["MESSAGE_STYLE"] === "uppercase"){
res.json({"message":"HELLO JSON"})
} else{
res.json({"messsage": "Hello json"})
}
})
Sure.
Read this a few times over…
Hope this helps
you define this when the app start, but the environment variable can change
if a variable can change, you usually takes its value from inside the function, so that you can deal with different values whenever the function is called
Hello, for some reason, I’m not passing the test on fcc but the code works. Can anyone tell me what I’m doing wrong?
Here’s the code:
https://boilerplate-express-2.veljkocukic.repl.co/json
var express = require('express');
var app = express();
const mySecret = process.env['MESSAGE_STYLE']
app.get("/json",(req,res)=>{
if(mySecret === "uppercase"){
res.json({"message":"HELLO JSON"})
}else{
res.json({"message":"Hello json"})
}
})
It’s the same as I said previously
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.