File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 11const { Tour } = require ( '@mui/icons-material' ) ;
22const Plant = require ( './../model/plantModel' ) ;
33
4+ exports . aliasFeaturedProducts = ( req , res , next ) => {
5+ req . query . limit = '8' ;
6+ req . query . sort = '-ratingsAverage,price' ;
7+ req . query . fields = 'name,price,imageCover' ;
8+ next ( ) ;
9+ } ;
10+
411exports . getAllPlants = async ( req , res ) => {
512 try {
613 // console.log(req.query);
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ const plantController = require('./../controllers/plantController');
44
55// router.param('id', plantController.checkID);
66
7+ router
8+ . route ( '/featured-products' )
9+ . get ( plantController . aliasFeaturedProducts , plantController . getAllPlants ) ;
10+
711router
812 . route ( '/' )
913 . get ( plantController . getAllPlants )
You can’t perform that action at this time.
0 commit comments