Untitled
unknown
plain_text
4 years ago
659 B
8
Indexable
exports.getNews = async (req, res, next) => { dateStart = new Date(req.query.dateStart.split('-')[0] , req.query.dateStart.split('-')[1]- 1, parseInt(req.query.dateStart.split('-')[2].substring(0,2))+ 1) dateEnd = new Date(req.query.dateEnd.split('-')[0] , req.query.dateEnd.split('-')[1]- 1, parseInt(req.query.dateEnd.split('-')[2].substring(0,2))+ 1) let news = await Newsarticle.find({date : { $gt : dateStart, $lt : dateEnd}, sports : { $in : req.query.sports}, organisations : { $in : req.query.organisations}}) res.status(201).json({ message: 'news fetched successfully', news: news }); }
Editor is loading...