Guys, I’m really stuck on this topic. can anybody help me?
the .env can no longer be created directly in “Files”, so I created it in the “secrets” folder. But it still doesn’t work and I have no idea what is going on!
This is my code:
var express = require('express');
var path = require('path');
var app = express();
app.get("/", function(req, res) {
res.sendFile(__dirname+ "/views/index.html");
})
app.use("/public",express.static(__dirname + "/public"))
app.get("/json", (req, res) => {
res.json({
message: "Hello json"
});
});
app.get('/json', (req, res) => {
const mySecret = process.env['.env']
mySecret === 'uppercase' ?
res.json({ "message": "HELLO JSON" }):
res.json({ "message": "Hello json" })
})
module.exports = app;