I cant seem to use the same endpoint in different route files.
index.js:
var users = require('./routes/users.js');
var orders = require('./routes/orders.js');
app.use('/users', users);
app.use('/orders', orders);
routes/users.js:
baseDep.router.get('/', function (req, res) {
res.json("This is the users route");
});
routes/orders.js
baseDep.router.get('/', function (req, res) {
res.json("This is the orders route");
});
localhost:3000/orders --> This is the users route
localhost:3000/users --> This is the users route
The second one works as expected.
The first one seems to using the endpoint in the users route file.
Can someone help figure out what I need to do?