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

185
Vistas
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 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