Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

60
Views
Express dynamically display associated page

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')
}) 

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!