Basic Node and Express - Serve Static Assets

Tell us what’s happening:

I tried writing code and it’s the same as it is given in the hint but my code is not working and my tests are not validating.
Here is my Code:
app.use(“/public”, express.static(__dirname + “/public”));

app.get(“/”, (req, res) => {
res.sendFile(__dirname + “/views/index.html”);
});

PS: I accidentally clicked the submit button in my previous challenge.

Your project link(s)

solution: https://boilerplate-express--tarunnakka30.repl.co

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0

Challenge Information:

Basic Node and Express - Serve Static Assets

Hi there and welcome to our community!

You have removed a rather vital line of code from the very bottom of your myApp.js file:

module.exports = app;

Put it back and your code should pass.

Thank You So Much :blush:I was about to give up

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