aboutsummaryrefslogtreecommitdiffstats
path: root/packages/api/routes/users.ts
blob: 81177fe34882fd564c1524610240e7a446b9e15e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Hono } from "hono";

import { authMiddleware } from "../middlewares/auth";

const app = new Hono()
  .use(authMiddleware)

  // GET /users/me
  .get("/me", async (c) => {
    const user = await c.var.api.users.whoami();
    return c.json(user, 200);
  })

  // GET /users/me/stats
  .get("/me/stats", async (c) => {
    const stats = await c.var.api.users.stats();
    return c.json(stats, 200);
  });

export default app;