Skip to content

Commit

Permalink
Merge pull request #25 from tolerious/feat/reading-articles
Browse files Browse the repository at this point in the history
🎨 Update today api.
  • Loading branch information
tolerious authored Feb 2, 2025
2 parents af0754c + 8c85476 commit 23071ba
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions routes/word.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ router.get("/thisweek", async function (req, res, next) {
router.get("/today", async function (req, res, next) {
const startOfDay = moment().startOf("day").toDate();
const endOfDay = moment().endOf("day").toDate();
const t = await wordModel.countDocuments({
createdAt: {
$gte: startOfDay,
$lt: endOfDay,
},
});
res.json(generateResponse({ count: t }));
const w = await wordModel
.find({ createdAt: { $gte: startOfDay, $lt: endOfDay } })
.exec();
res.json(generateResponse({ count: w.length, wordList: w }));
});

router.get("/:id", async function (req, res, next) {
Expand Down

0 comments on commit 23071ba

Please sign in to comment.