const ResponeSchema = z.object({
message: z.string(),
email: z.string().email(),
});
export const secret = new OpenAPIHono<{
Variables: ContextVariables;
}>().openapi(
createRoute({
method: "get",
path: "/api/secret",
tags: ["Secret"],
summary: "Shhh...",
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: ResponeSchema,
},
},
},
},
}),
(c) => {
const user = c.get("user")!;
return c.json(
{
message: "Secret Message",
email: user.email,
},
200
);
}
);
const ResponeSchema = z.object({
message: z.string(),
email: z.string().email(),
});
export const secret = new OpenAPIHono<{
Variables: ContextVariables;
}>().openapi(
createRoute({
method: "get",
path: "/api/secret",
tags: ["Secret"],
summary: "Shhh...",
responses: {
200: {
description: "Success",
content: {
"application/json": {
schema: ResponeSchema,
},
},
},
},
}),
(c) => {
const user = c.get("user")!;
return c.json(
{
message: "Secret Message",
email: user.email,
},
200
);
}
);