Question: Given a MongoDB router like the BigsRouter in JavaScript below explain what that router is doing, what it needs, and it s data access pattern.
Given a MongoDB router like the BigsRouter in JavaScript below explain what that router is doing, what it needs, and its data access pattern.
import Router from "express";
import ObjectId from "mongoallData";
import SmallsRouter from smallsjs;
const BigsRouter Router;
BigsRouter.use:bigIdsmalls SmallsRouter;
BigsRouter.get async req res
const smalls await allData.collectionbigsfindtoArray;
const allData req.app.getallData;
return res.jsonsmalls;
;
BigsRouter.get:id async req res
const allData req.app.getallData;
const small await allData.collectionbigsfindOneid: new ObjectIdreqparams.id;
return res.jsonsmall;
;
BigsRouter.post async req res
const allData req.app.getallData;
;
BigsRouter.put:id async req res
req.body.id new ObjectIdreqparams.id;
const allData req.app.getallData
return res.statusend;
;
BigsRouter.delete:id async req res
const allData req.app.getallData;
return res.statusend;
;
export default BigsRouter;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
