I am creating a rest API for my company for reporting Routs to pass dates to find data from 2 given dates
router.get('/smDcr/:currentDate?&:lastDate:', authorize, getDcrBetweenDates);
Controller action to get the data between dates
exports.getDcrBetweenDates = async(req, res, next) => {
    try{
        const lastDate = req.params.lastDate;
        const currentDate = req.params.currentDate;
        console.log(lastDate);
        const dcr = await Dcr.find({
            where: {
                createdAt: {
                    $between:[currentDate, lastDate]
                }
            }
        });
        if(!dcr) return res.status(400).json({message: "No DCR found between mentioned Dates!!"});
        return res.status(200).json({ dcr});
    }catch(ex){
        next(ex)
    }
}
while passing parameter in postman I am getting all reports not specific to the dates given in params http://localhost:3000/smDcr/?currentDate=2019/09/11&?lastDate=2019/09/11
 
     
    