13 lines
338 B
JavaScript
13 lines
338 B
JavaScript
const router = require('express').Router()
|
|
const { OrderModel } = require('./model/order')
|
|
|
|
router.get('/orders', async (req, res, next) => {
|
|
try {
|
|
const orders = await OrderModel.find({})
|
|
res.status(200).send({ success: true, body: orders })
|
|
} catch (error) {
|
|
next(error)
|
|
}
|
|
})
|
|
|
|
module.exports = router |