Skip to content

Commit 03b8e5b

Browse files
sort questions
1 parent 84ed34f commit 03b8e5b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/controllers/Questions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export const AskQuestion = async (req, res) => {
1616

1717
export const getAllQuestions = async (req, res) => {
1818
try {
19-
const questionList = await Questions.find();
19+
// question oldest to newest
20+
const questionList = await Questions.find().sort({ askedOn: 1 });
2021
res.status(200).json(questionList);
2122
} catch (error) {
2223
res.status(404).json({ message: error.message });

0 commit comments

Comments
 (0)