diff --git a/new-functions/src/index.ts b/new-functions/src/index.ts index 77c8ad1..61f1cc7 100644 --- a/new-functions/src/index.ts +++ b/new-functions/src/index.ts @@ -7,9 +7,20 @@ app.get("/", (c) => { return c.text("Hi from hono updated"); }); -app.get("/wa", (c) => { +app.get("/wa", async (c) => { + const cookie = c.req.header("Cookie") || ""; + const r = await fetch("https://account.lingdocs.com/api/user", { + headers: { cookie }, + }); + const { ok, user } = await r.json(); + // const { + // headers: { cookie }, + // } = c. req; + // if (!cookie) { + // return { req: null, res }; + // } // c.env.LINGDOCS_COUCHDB - return c.text("Hi other route"); + return c.json({ ok, user }); }); export default app;