Basic Node and Express - Serve Static Assets

Tell us what’s happening:
I’m unable to pass the challenge.

my app is able to serve the CSS file (as shown below) from the /public directory but when I paste my solution into the link it’s not bringing me to the next challenge.
I cloned the repo and am working on my VS code.

Thank you.

This is my code

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

app.get('/', (req, res) => {
    res.sendFile(__dirname + '/views/index.html')

app.use('/public', express.static(__dirname + '/public'))

const port = process.env.PORT || 3000;

module.exports = app;

Your browser information:

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

Challenge: Basic Node and Express - Serve Static Assets

Link to the challenge:

What is the url for your publicly accessible server?

This is the URL: http://localhost:3000/

The issue has been resolved, I’m able to advance to the next challenge. I reverted the “main” and “start” fields to server.js and removed my port variable and app.listen function. Is there is a reason why this is so? hmmm.
Anyway thank you for assisting!

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