Skip to content

Instantly share code, notes, and snippets.

@beauwilliams
Last active January 8, 2025 01:25
Show Gist options
  • Save beauwilliams/4ac0201b76b198840127a7bbe84a7b40 to your computer and use it in GitHub Desktop.
Save beauwilliams/4ac0201b76b198840127a7bbe84a7b40 to your computer and use it in GitHub Desktop.
registry.registerPath({
method: "get",
path: "/user",
summary: "Get the authenticated user's profile",
handler: "getUserHandler", //Now we declare handlers here
middleware: ["authenticateJWTMiddleware"], //And middleware
parameters: [
{
name: "Authorization",
in: "header",
required: true,
schema: {
type: "string",
description: "JWT token for user authentication",
example: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
},
},
],
responses: {
200: {
description: "User profile retrieved successfully",
content: {
"application/json": {
schema: { $ref: "#/components/schemas/TelegramUser" },
},
},
},
404: {
description: "User not found",
},
403: {
description: "Invalid or expired JWT",
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment