mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-02 19:26:50 -05:00
24 lines
520 B
TypeScript
24 lines
520 B
TypeScript
import { NextApiRequest, NextApiResponse } from "next";
|
|
import {
|
|
getUserByIdentifier,
|
|
GetUserByIdentifierData,
|
|
} from "prisma/queries/getUserByIdentifier";
|
|
|
|
const userHandler = async (
|
|
req: NextApiRequest,
|
|
res: NextApiResponse<GetUserByIdentifierData>
|
|
) => {
|
|
if (req.method !== "GET") {
|
|
return res.status(405).end();
|
|
}
|
|
|
|
try {
|
|
const user = await getUserByIdentifier(req.query.id as string);
|
|
res.status(200).json(user!);
|
|
} catch {
|
|
res.status(404).end();
|
|
}
|
|
};
|
|
|
|
export default userHandler;
|