April 2020
Intermediate to advanced
716 pages
18h 55m
English
To be able to display all the auctions that a given user placed bids in, we will define a backend API that accepts a GET request and queries the Auction collection so that it returns the relevant auctions in the response. To implement this auctions by bidder API, we will declare a route, as shown here.
mern-marketplace/server/routes/auction.routes.js
router.route('/api/auctions/bid/:userId') .get(auctionCtrl.listByBidder)
A GET request, when received at the /api/auctions/bid/:userId route, will invoke the listByBidder controller method, which will query the Auction collection in the database so that it returns all the auctions that contain bids with a bidder matching the user specified by the userId parameter in ...
Read now
Unlock full access