Skip to Content
Routes (HTTP URLs)Overview

Routes (HTTP URLs)

Path: hono-backend/src/routes/

Routes are waiters: they take HTTP requests, check input, call services, return JSON.

All route files

FileMounted atAudience
auth.route.ts/api/v1/authEveryone logging in
user.route.ts/api/v1/usersLogged-in students
admin.route.ts/api/v1/adminStaff (large file)
practice-pyq-public.routes.ts/api/v1/practice-pyq, /practice-ytStudent practice
practice-pyq-admin.routes.ts(inside admin)PYQ bank editing
current-affairs-public.routes.ts/api/v1/current-affairsCA reader
current-affairs-admin.routes.ts(inside admin)CA editor
marketing-admin.routes.ts/api/v1/admin/marketing (nested)Sponsors and coupon deals
admin-rate-limits.routes.ts/api/v1/admin/rate-limitsDynamic rate-limit policies (super admin)
notification.route.ts/users, /admin/notifications, /internal/notificationsPush prefs + worker
timestamps.route.ts/api/v1Video timestamps

Typical route file pattern

export const myRouter = new Hono() // typed with HonoEnv in real code myRouter.use('*', authMiddleware) myRouter.post('/thing', async (c) => { const body = schema.parse(await c.req.json()) const result = await someService.doThing(c.get('userId'), body) return c.json(result) })

Rules

  1. Validate with Zod (validators/ or inline schemas).
  2. Authorize in service or with permission checks — not “trust the client”.
  3. Return DTOs — don’t leak Mongoose internals.
  4. Keep files from becoming 2000-line monsters — extract services.

Deep dives

Last updated on