About the problem of express routin

var router = express.Router();

router.get("/", function(req, res) {
  res.send("<h1>Hello World</h1>");
});

app.use("/home", router)
The

above code creates a new routing object that returns Hello World when the access root route (/) is specified. The route is then loaded in the / home path, that is, accessing / home returns Hello World.
but if you add a route

 router.get("/a", function(req, res) {
      res.send("<h1>Hello pojia</h1>");
    });

there are two routes"/","/ a"at this time. What will be output if you visit"/ home" at this time? Why?

Apr.02,2021

/ home output Hello World
/ home/a will output Hello pojia
/ and / an are both Notfound


Hello World


you happen to use express's skill of managing routing levels.
app.use ('/ home',router)-express transfers requests under route / home to router. / and / a set in router are relative to / home , that is, they correspond to / home/ and / home/a respectively.
above, the "hierarchical" management of routing is realized.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eadf8e-2196.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eadf8e-2196.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?