Update controllers

This commit is contained in:
AndrewTrieu
2023-03-09 17:10:23 +02:00
parent e6d68e98d6
commit 4f94f70a9b
5 changed files with 188 additions and 44 deletions

View File

@@ -1,5 +1,18 @@
import { countTopics } from "../../services/topicService.js";
import { countQuestions } from "../../services/questionService.js";
import { countAnswers } from "../../services/answerService.js";
const showMain = ({ render }) => {
render("main.eta");
const statistics = {
totalTopics: 0,
totalQuestions: 0,
totalAnswers: 0,
};
statistics.totalTopics = countTopics();
statistics.totalQuestions = countQuestions();
statistics.totalAnswers = countAnswers();
render("main.eta", statistics);
};
export { showMain };