boredgame/src/lib/server/api/controllers/iam.controller.ts

22 lines
518 B
TypeScript
Raw Normal View History

2024-07-21 19:05:48 +00:00
import { Hono } from 'hono';
import { injectable } from 'tsyringe';
import type { HonoTypes } from '../types';
2024-07-21 19:05:48 +00:00
import { requireAuth } from "../middleware/auth.middleware";
import type { Controller } from '../interfaces/controller.interface';
2024-07-21 19:05:48 +00:00
@injectable()
export class IamController implements Controller {
controller = new Hono<HonoTypes>();
2024-07-21 19:05:48 +00:00
constructor(
) { }
routes() {
return this.controller
.get('/me', requireAuth, async (c) => {
const user = c.var.user;
return c.json({ user });
});
}
}