返回 DeepSeek-Reasonix
app.ts
根目录 / workers / accounts / src / app.ts
1 import { Hono } from "hono";
2 import type { AppEnv } from "./env";
3 import { corsMiddleware } from "./http/cors";
4 import { loadUser } from "./http/auth";
5 import { errorHandler, notFoundHandler } from "./http/errors";
6 import health from "./routes/health";
7 import auth from "./routes/auth";
8 import device from "./routes/device";
9 import me from "./routes/me";
10 import users from "./routes/users";
11
12 const app = new Hono<AppEnv>();
13
14 app.onError(errorHandler);
15 app.notFound(notFoundHandler);
16
17 app.use("*", corsMiddleware);
18 app.use("*", loadUser);
19
20 app.route("/", health);
21 app.route("/auth", auth);
22 app.route("/device", device);
23 app.route("/me", me);
24 app.route("/u", users);
25
26 export default app;
27
27 lines TYPESCRIPT