const Router require express const router Router const user require mo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
const { Router } = require('express')
const router = Router()
const user = require('../models/User')
// Get all users
router.get('/get', async (req, res) => {
try {
const users = await user.find();
// ... Another aggregations
return res.json({ users });
} catch (error) {
logger.error(error);
return res.status(500).send();
}
})
module.exports = router;