Restored to '3905f52571b4fa7e048e16d7a3b94ee66307d072'

Replit-Restored-To: 3905f52571
This commit is contained in:
sebastjanartic
2026-03-05 12:19:10 +00:00
parent 7434438c1e
commit c13a5150b8
41 changed files with 1706 additions and 667 deletions
+13
View File
@@ -86,6 +86,19 @@ export async function registerRoutes(
});
app.get("/api/articles/category/:category", async (req, res) => {
const page = parseInt(req.query.page as string);
const limit = parseInt(req.query.limit as string) || 12;
if (page && page > 0) {
const result = await storage.getArticlesByCategoryPaginated(req.params.category, page, limit);
const totalPages = Math.ceil(result.total / limit);
return res.json({
articles: result.articles,
total: result.total,
page,
totalPages,
hasMore: page < totalPages,
});
}
const articles = await storage.getArticlesByCategory(req.params.category);
res.json(articles);
});