Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

The Auctions by seller API

Sellers in the marketplace will see a list of auctions that they created. To retrieve these auctions from the database, we will define a backend API that accepts a GET request and queries the Auction collection so that it returns the auctions by a specific seller. To implement this auctions by seller API, we will declare a route, as shown here.

mern-marketplace/server/routes/auction.routes.js:

router.route('/api/auctions/by/:userId')  .get(authCtrl.requireSignin, authCtrl.hasAuthorization,        auctionCtrl.listBySeller)

A GET request, when received at the /api/auctions/by/:userId route, will invoke the listBySeller controller method, which will query the Auction collection in the database so that it returns all the auctions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content