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

182
Views
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
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!