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

200
Views
Express Routing - I don't get a response from home "/"

When I try to connect the route home "/" with the layout of handlebars "home", it works with app.get, but when I use router.get I don't get a response (don't render). Anyway, it works with another routes like "/auth"

home router

const express = require("express");
const router = express.Router();

router.get("/", (req, res) => {
  res.render("home", { urls })
})

module.exports = router;

auth router

const express = require("express");
const router = express.Router();

router.get("/", (req, res) => {
  res.render("login")
})

module.exports = router;

index.js

const express = require("express")
const { create } = require("express-handlebars")

const app = express();

// hbs configuration
const hbs = create({
  extname: ".hbs",
  partialsDir: ["views/components"]
})

app.engine(".hbs", hbs.engine)
app.set("view engine", ".hbs")
app.set("views", "./views")

// middlewares
app.use(express.static(__dirname + "/public"))
app.use('/', require('./routes/home'));
app.use("/auth", require("./routes/auth"))

// server
app.listen(5000, () => {
    console.log("server updated")
})
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!