Use the .env File completed solution using replit

Solution
var express = require('express');
var app = express();
console.log("Hello World");

app.get("/", function(req, res) {
  res.sendFile(__dirname + "/views/index.html");
});
// Normal usage

// Assets at the /public route
app.use("/public", express.static(__dirname + "/public"));

app.get('/json',(req,res)=>{
  if(process.env.MESSAGE_STYLE==="uppercase"){
res.json({
"message":"HELLO JSON"
})
  }else{
    res.json({
      "message":"Hello json"
    })
  }
})

HI @ihsanumair !

Welcome to the forum!

I have updated your post in the correct format for guide post suggestions.

Please read these instructions on how to make future guide post suggestions.

Thank you, for your contribution. For future contributions, please wrap your solution within :

[details]
```
code goes here...
```
[/details]

Also, provide all of the necessary code to pass the challenge.

Also, when you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor ( </> ) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

its okay
it is done by mistake

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