var express = require('express');
var router = express.Router();
var Product = require('../models/Product');
...
// The same as the other routers
...
/**
* Gets the items in the category index
*/
router.get(
'/employee/:id',
wrapErrors(async (req, res) => {
var data = await Product.query({
indexName: 'employeeId',
keyCondition: {
values: [{ ':id': req.params.id }],
expression: '#key = :id'
}
});
res.status(200).json({ data });
})
);
module.exports = router;