I have a simple express app.
The problem i have now is when any of the navigation link (Home, Home1, Home2) is clicked, it's returning an error but if i type http://localhost:8001/home1 -> it will display home1.html.
so, what i wanted is, by the time user click one of the navigation link, it should take them to the appropriate page.
Any help, i will highly appreciate.
var express = require("express");
var app = express();
app.use('/temp', express.static(__dirname '/temp'));
app.get('/home', function(req, res){
res.sendFile(__dirname '/temp/home.html')
})
CodePudding user response:
Don't use ./
in your HTML links. Change your links in the HTML to start with /
instead so that the links do not depend upon the path of the current page's URL.