From e1d06e35efddaccc1135003634ddbc570906e61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Intevel=20=E3=83=84?= <59223342+Intevel@users.noreply.github.com> Date: Sat, 24 Apr 2021 00:10:18 +0200 Subject: [PATCH] Create index.ts --- src/routes/users/#id/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/routes/users/#id/index.ts diff --git a/src/routes/users/#id/index.ts b/src/routes/users/#id/index.ts new file mode 100644 index 00000000..ca280597 --- /dev/null +++ b/src/routes/users/#id/index.ts @@ -0,0 +1,15 @@ +import { Router, Request, Response } from "express"; +import { UserModel } from "@fosscord/server-util"; +import { HTTPError } from "lambert-server"; + +const router: Router = Router(); + +router.get("/", async (req: Request, res: Response) => { + const { id } = req.params; + const user = await UserModel.findOne({ id: id }).exec(); + if (!user) throw new HTTPError("User not found", 404); + + res.json(user); +}); + +export default router;