Skip to content

Commit c68c9af

Browse files
BackendExpertJehanKandyAnupa1998
committed
Update UserController.js
Co-Authored-By: JehanKandy <jehankandy@gmail.com> Co-Authored-By: Anupa Gamage <125038143+Anupa1998@users.noreply.github.com>
1 parent 34cfedc commit c68c9af

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/Controllers/UserController.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ const UserController = {
44
CountUsers: async(req, res) => {
55
try{
66
const UserCount = await User.countDocuments()
7+
8+
if(UserCount){
9+
return res.json({Result: UserCount})
10+
}
11+
else{
12+
return res.json({Error: "Internal Server Error"})
13+
}
714
}
815
catch (err) {
916
console.log(err)

0 commit comments

Comments
 (0)