Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

69
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda