Hello guys,
I have covered lot of things in this video for you,
1) REST API to get distinct floors from the slots collection. - GET request
2) REST API to get distinct wings based on the selected floor from the slots collection. - GET request
3) REST API to get all the slots for a selected wing from the slots collection.-GET request
4) REST API to update the created slots for a particular floor and wing in the slots collection - PUT request
5) REST API to create new floors and slots in the slots collection - POST request
6) REST API to get all the records and show it in grid - GET request
7) REST API to get a single slot and bind it in the popup - GET request
8) REST API to update the single slot in the popup - PUT request
9) REST API to delete the slot from the grid - PUT request
I have implemented the following mongoose queries in this video.
1) await Slots.distinct('floorName', {isActive: req.params.active})
2) await Slots.distinct('wingName', { floorName: req.params.floor })
3) await Slots.find({ floorName: req.params.floor, wingName: req.params.wing, }).select({
'slots.slotName': 1,
'slots._id': 1,
'slots.capacity': 1,
'slots.vehicleType': 1,
'slots.isAvailable': 1,
wingName: 1,
_id: 1,
})
4) await Slots.find( {'slots._id': req.params.id }, { 'slots.$': 1 } ).select({
floorName: 1,
wingName: 1,
isFullyOccupied: 1,
isActive: 1,
})
5) await Slots.updateOne({ 'slots._id': req.params.id }, {$set: {
'slots.$.capacity': capacity,
floorName: floorName,
}})
6) await Slots.find({ floorName: floor, wingName: wing}).select({
_id: 1,
})
7) await Slots.findByIdAndUpdate({ _id: findWing },
{ $push: { slots: { $each: req.body } } },
{
new: true,
upsert: true,
})
8) await Slots.updateOne(
{ _id: req.params.floorId },
{ $pull: { slots: { _id: req.params.slotId } } },
)
I have explained the maximum concepts in creating the REST APIs. Watch the complete video guys.
I have taught how to attach the debugger and test the APIs. Also I have used postman to test the APIs.
ABOUT MY CHANNEL
My channel is about teaching how to develop projects with the Frontend and Backend technologies easily. I have covered lot of cool stuffs especially for the beginners.
Check out my channel here:
/ @learnthinkcreatecode
Don't forget to subscribe!
CHECK OUT MY OTHER VIDEOS
Parking Management System Backend: • Parking Management System - Backend using ...
Parking Management System Frontend: • Parking Management System - Frontend
Visitors Management System Backend: • Visitors Management system
Visitors Management System Frontend: • Visitors Management System - Frontend
Please visit this website if you are planning for tour and travel. I may receive a small commission for bookings made through these website.
For Cheap Flights booking: https://letstourandtravel.com/
For Hotel bookings: https://letstourandtravel.com/hotels/
For Cruises bookings: https://letstourandtravel.com/cruise/
For amazon products: https://letstourandtravel.com/shop/
Thank you guys for your love and support.
In questa pagina del sito puoi guardare il video online Node.js Tutorial for Beginners #8 | Create RESTful APIs using Node.js, Express and MongoDB della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Learn, Think & (Create) Code 24 luglio 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,566 volte e gli è piaciuto 133 spettatori. Buona visione!