Tell us what’s happening:
Describe your issue in detail here.
So i’m using replit and keep getting an error, idk what to do.
https://replit.com/@shadownightmare/boilerplate-express-1#myApp.js
Your code so far
let express = require('express');
let app = express();
let absolutePath = __dirname + "/views/index.html";
app.use(express.static(__dirname + "/public"));
/*
app.get("/", (req, res) => {
res.send("Hello Express")
})
*/
app.get("/", (req, res) => {
res.sendFile(absolutePath)
});
app.get("json", (req, res) => {
res.json({"message":process.env['MESSAGE_STYLE'] == "uppercase" ? "HELLO JSON" : "hello json"})
})
console.log("Hello World")
module.exports = app;
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 OPR/89.0.4447.104
Challenge: Basic Node and Express - Use the .env File
Link to the challenge: