This code is not working

app.get("/", (req, res, next) => {
var fullUrl = req.protocol + ‘://’ + req.get(‘host’) + req.originalUrl;
console.log(fullUrl);
next();
res.sendFile(__dirname + “/views/index.html”);
});

this code is not working, why??

The site remains loading

Can you show us your logs?

You don’t need to call the next() function.

3 Likes

yes next() is only for middleware not for simple get requests.

2 Likes