Thursday 23 August 2018

Couple of noob question about routers and app.use

I've installed the default express.js application.It has this line:app.use("/users", usersRouter); If I open up usersRouter it has this line:router.get('/', function(req, res, next) { res.send('respond with a resource'); }); Whats with the slash in router.get('/')? Would doing:app.use("/", usersRouter); router.get('/users', function(req, res, next) { res.send('respond with a resource'); }); ...achieve the same?Is the slash in the router.get relative to the path given to it by app.use?

Submitted August 23, 2018 at 01:45PM by Whale_Eating_Cheese

No comments:

Post a Comment