Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

62
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda