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

168
Views
Use different routes depending on the host header with express

Is there an easy way to use completely different routes depending on the host header. Maybe something like this?

const app1 = express('domain1.com');
const app2 = express('domain2.com');

app1.get('*', function(req, res) {
    res.status(200).send('connecting to domain1.com');
});

app2.get('*', function(req, res) {
    res.status(200).send('connecting to domain2.com');
});

Both the apps listen on the same port but the routes are different for the different domains. Obviously that code doesn't work but is there a good way to go about it?

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!