aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/server/index.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-12-06 18:11:14 +0900
committernsfisis <nsfisis@gmail.com>2025-12-06 18:25:52 +0900
commite367c698e03c41c292c3dd5c07bad0a870c3ebc4 (patch)
tree256c022a03b3f213a75261595ffddc0f87c0475b /src/server/index.ts
parent17ba3c603e4c522ccca282f6786fff2e0b3f4f6e (diff)
downloadkioku-e367c698e03c41c292c3dd5c07bad0a870c3ebc4.tar.gz
kioku-e367c698e03c41c292c3dd5c07bad0a870c3ebc4.tar.zst
kioku-e367c698e03c41c292c3dd5c07bad0a870c3ebc4.zip
feat(client): add API client with auth header support
Implements fetch wrapper that handles JWT authentication, automatic token refresh on 401 responses, and provides typed methods for REST operations. Includes comprehensive tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'src/server/index.ts')
-rw-r--r--src/server/index.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 01a489f..d157f74 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -9,15 +9,17 @@ const app = new Hono();
app.use("*", logger());
app.onError(errorHandler);
-app.get("/", (c) => {
- return c.json({ message: "Kioku API" });
-});
-
-app.get("/api/health", (c) => {
- return c.json({ status: "ok" });
-});
-
-app.route("/api/auth", auth);
+// Chain routes for RPC type inference
+const routes = app
+ .get("/", (c) => {
+ return c.json({ message: "Kioku API" }, 200);
+ })
+ .get("/api/health", (c) => {
+ return c.json({ status: "ok" }, 200);
+ })
+ .route("/api/auth", auth);
+
+export type AppType = typeof routes;
const port = Number(process.env.PORT) || 3000;
console.log(`Server is running on port ${port}`);