Skip to content

Commit

Permalink
get all users
Browse files Browse the repository at this point in the history
  • Loading branch information
riv-k committed Jul 13, 2024
1 parent 5b37664 commit b675500
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/routes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ userRoutes.post("/add-event-created", async (req: Request, res: Response) => {
}
});

userRoutes.get("/:id", async (req: Request, res: Response) =>{
userRoutes.get("/get/:id", async (req: Request, res: Response) =>{
const { id } = req.params;
console.log(id)
try{
Expand All @@ -106,5 +106,12 @@ userRoutes.get("/:id", async (req: Request, res: Response) =>{
}
})


userRoutes.get("/get-all-users", async (req: Request, res: Response) =>{
try{
const users = await User.find();
res.status(200).json(users);
}catch (error: any){
res.status(400).json({ message: error.message });
}
})
export default userRoutes;

0 comments on commit b675500

Please sign in to comment.