From e367c698e03c41c292c3dd5c07bad0a870c3ebc4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Dec 2025 18:11:14 +0900 Subject: feat(client): add API client with auth header support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/server/index.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/server/index.ts') 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}`); -- cgit v1.2.3-70-g09d2