Tell us what’s happening:
i created a .env file
but it was not possible to edit content.
therefore i did it local and upload this .env
hopefully it was overwritten.
is still cant see the contend of .env
and my test don’t work
as content of my .env i used:
MESSAGE_STYLE=uppercase
app code:
let express = require('express');
let app = express();
const path = require('path');
// console.log("Hello Express");
// console.log('__dirname=' + __dirname); // __dirname=/home/runner/boilerplate-express
app.get("/", (req, res) => {
// res.sendFile('/views/index.html');
res.sendFile(path.join(__dirname, '/views/index.html'));
});
app.get("/json", (req, res) => {
res.json({
message: "Hello json".toUpperCase()
});
});
// Assets at the /public route
app.use('/public', express.static(__dirname + '/public'));
module.exports = app;
Error:
The response of the endpoint /json should change according to the environment variable MESSAGE_STYLE
Your project link(s)
solution: boilerplate-express - Replit
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: