Basic Node and Express - Serve Static Assets

Tell us what’s happening:

Ok, this is what I have so far. I don’t know what happens but it is not working even though everything seems to be alright. I have checked other Forums, checked chatGPT, youtube videos but is like the style.css file is not getting hooked up.

###Your project link(s)

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


let absolutepath = __dirname + "/views/index.html"
let path = "public/style.css";

//app.use(express.static(__dirname + "/public"));

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

app.get("/", (req, res) => {
  res.sendFile(absolutepath)
})


console.log('Hello World')

solution: https://13331d7c-04aa-4fac-bc73-eb8b79d1e73b-00-3jfbrbvfhm3oq.kirk.replit.dev

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

Basic Node and Express - Serve Static Assets

Please post the link to the Replit editor with the code.

I assume that isn’t all the code and you still have the export at the bottom of the file that was in the starting code?

Your app.use for the challenge is correct.