.env file challenge (replit)

Tell us what’s happening:
Hi! I’m trying to pass the “.env file” challenge and it seems to be working, but I am still not passing the tests…

code:

var express = require('express');
var app = express();


app.get("/json", function (req, res) {
  process.env.MESSAGE_STYLE==="uppercase" 
    ?
    res.json(
        {"message": "HELLO JSON"}
    )
    :
    res.json(
        {"message": "Hello json"}
    )


})

Your project link(s)

solution: https://replit.com/@ksulcova/boilerplate-express

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36.

Challenge: Use the .env File

Link to the challenge:

I would try two things.

First I would change strict equality to normal equality.
If that would not work I’d also change the way I access env property to env['prop'].

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.