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

183
Visualizações
How to use another pathname to send React index.html

I need to clarify that I'm still learning, and therefore I don't know if what I'm trying to do is good practice or not. To the point.

I'm building a website with React, using Node.js with express in the backend, that allows an admin to modify certain aspects of the website without messing with the code (I'm sure this has a name, but idk) the thing is, I'm sending "index.html" when the root path ("/") is accessed, I'm trying to use another, called "/admin", that when accessed, it will send another .html or something.

app.use(express.static(path.join(__dirname, 'build')));


app.get('/', function (req, res) {
  res.sendFile(path.join(__dirname, 'build', 'index.html'));
});

app.get('/admin', function (req, res) {
  res.sendFile(path.join(__dirname, 'build', 'admin.html'));

});

Implementing something along those lines has been a pain, I've tried using 2 separate index.html, using each one to link a different index.js file, I even using 2 different builds of the same project, all experiments resulting in missing styles, missing animations and a literal mountain of different errors, I'm sure this can be done in a really dumb way but I lack the terminology to make a proper Google search, thanks in advance.

about 4 years ago · Juan Pablo Isaza
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