April 2020
Intermediate to advanced
716 pages
18h 55m
English
To complete the edit auction and delete auction operations initiated by sellers from the frontend, we need to have the corresponding APIs in the backend. The route for these API endpoints, which will accept the update and delete requests, can be declared as follows.
mern-marketplace/server/routes/auction.routes.js:
router.route('/api/auctions/:auctionId') .put(authCtrl.requireSignin, auctionCtrl.isSeller, auctionCtrl.update) .delete(authCtrl.requireSignin, auctionCtrl.isSeller, auctionCtrl.remove)router.param('auctionId', auctionCtrl.auctionByID)
The :auctionId param in the /api/auctions/:auctionId route URL will invoke the auctionByID controller method, which is similar to the userByID controller method. It ...
Read now
Unlock full access